Use the webpack dev server proxy for requests
This commit is contained in:
parent
2a8b474fa1
commit
3b3f785984
@ -11,8 +11,6 @@ import (
|
|||||||
|
|
||||||
// GetStatus gets the status of the server.
|
// GetStatus gets the status of the server.
|
||||||
func GetStatus(w http.ResponseWriter, r *http.Request) {
|
func GetStatus(w http.ResponseWriter, r *http.Request) {
|
||||||
middleware.EnableCors(w)
|
|
||||||
|
|
||||||
status := core.GetStatus()
|
status := core.GetStatus()
|
||||||
response := webStatusResponse{
|
response := webStatusResponse{
|
||||||
Online: status.Online,
|
Online: status.Online,
|
||||||
|
@ -2,4 +2,12 @@ const withLess = require('next-with-less');
|
|||||||
|
|
||||||
module.exports = withLess({
|
module.exports = withLess({
|
||||||
trailingSlash: true,
|
trailingSlash: true,
|
||||||
|
async rewrites() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: '/api/:path*',
|
||||||
|
destination: 'http://localhost:8080/api/:path*', // Proxy to Backend to work around CORS.
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ChatMessage } from '../interfaces/chat-message.model';
|
import { ChatMessage } from '../interfaces/chat-message.model';
|
||||||
import { getUnauthedData } from '../utils/apis';
|
import { getUnauthedData } from '../utils/apis';
|
||||||
const ENDPOINT = `http://localhost:8080/api/chat`;
|
const ENDPOINT = `/api/chat`;
|
||||||
const URL_CHAT_REGISTRATION = `http://localhost:8080/api/chat/register`;
|
const URL_CHAT_REGISTRATION = `/api/chat/register`;
|
||||||
|
|
||||||
interface UserRegistrationResponse {
|
interface UserRegistrationResponse {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import ServerStatus from '../interfaces/server-status.model';
|
import ServerStatus from '../interfaces/server-status.model';
|
||||||
|
|
||||||
const ENDPOINT = `http://localhost:8080/api/status`;
|
const ENDPOINT = `/api/status`;
|
||||||
|
|
||||||
class ServerStatusService {
|
class ServerStatusService {
|
||||||
public static async getStatus(): Promise<ServerStatus> {
|
public static async getStatus(): Promise<ServerStatus> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user