0

Use the webpack dev server proxy for requests

This commit is contained in:
Gabe Kangas 2022-05-08 23:28:54 -07:00
parent 2a8b474fa1
commit 3b3f785984
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA
4 changed files with 11 additions and 5 deletions

View File

@ -11,8 +11,6 @@ import (
// GetStatus gets the status of the server.
func GetStatus(w http.ResponseWriter, r *http.Request) {
middleware.EnableCors(w)
status := core.GetStatus()
response := webStatusResponse{
Online: status.Online,

View File

@ -2,4 +2,12 @@ const withLess = require('next-with-less');
module.exports = withLess({
trailingSlash: true,
async rewrites() {
return [
{
source: '/api/:path*',
destination: 'http://localhost:8080/api/:path*', // Proxy to Backend to work around CORS.
},
];
},
});

View File

@ -1,7 +1,7 @@
import { ChatMessage } from '../interfaces/chat-message.model';
import { getUnauthedData } from '../utils/apis';
const ENDPOINT = `http://localhost:8080/api/chat`;
const URL_CHAT_REGISTRATION = `http://localhost:8080/api/chat/register`;
const ENDPOINT = `/api/chat`;
const URL_CHAT_REGISTRATION = `/api/chat/register`;
interface UserRegistrationResponse {
id: string;

View File

@ -1,6 +1,6 @@
import ServerStatus from '../interfaces/server-status.model';
const ENDPOINT = `http://localhost:8080/api/status`;
const ENDPOINT = `/api/status`;
class ServerStatusService {
public static async getStatus(): Promise<ServerStatus> {