You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a very simple app as below, but on adding the app.use(cors) it causes the app to hang indefinitely on all requestss
I disabled all other related config packages
as soon as I comment out app.use(cors); everything works again.
seems really simple - what could be wrong?
importcorsfrom"cors";importexpress,{Application}from"express";// import compression from "compression";// import cookieParser from "cookie-parser";// import helmet from "helmet";// import morgan from "morgan";constExpressConfig=(): Application=>{constapp=express();app.options("*",cors());// include before other routesapp.use(cors);app.use(express.json());returnapp;};exportdefaultExpressConfig;// server.tsfunctionsetup(){constapp=ExpressConfig();app.get("/",(_req: any,res)=>{res.send("Hello World");});app.listen(PORT,()=>console.log("Server Running on Port "+PORT));}setup();
I have a very simple app as below, but on adding the
app.use(cors)
it causes the app to hang indefinitely on all requestssI disabled all other related config packages
as soon as I comment out
app.use(cors);
everything works again.seems really simple - what could be wrong?
The text was updated successfully, but these errors were encountered: