Enabled cors inside the server.ts
This commit is contained in:
parent
119446d563
commit
96a0b418f2
@ -2,6 +2,7 @@ import express, { Application, Request, Response } from "express";
|
|||||||
import mongoose, { CallbackError } from "mongoose";
|
import mongoose, { CallbackError } from "mongoose";
|
||||||
import v1Router from "./routes/v1";
|
import v1Router from "./routes/v1";
|
||||||
import { sendError } from "@utils/error";
|
import { sendError } from "@utils/error";
|
||||||
|
import cors from "cors";
|
||||||
|
|
||||||
const MONGOOSE_STRING = process.env.MONGOOSE_STRING || "mongodb://localhost:27017";
|
const MONGOOSE_STRING = process.env.MONGOOSE_STRING || "mongodb://localhost:27017";
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ const isDevelopment: boolean = process.env.NODE_ENV !== "production";
|
|||||||
|
|
||||||
// Configure backend
|
// Configure backend
|
||||||
app.disable("x-powered-by");
|
app.disable("x-powered-by");
|
||||||
|
app.use(cors());
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
||||||
// Configure routers
|
// Configure routers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user