Enable CORS for express
This commit is contained in:
parent
9be03784d2
commit
493372633c
|
@ -3,9 +3,16 @@ import bodyParser from "body-parser";
|
|||
|
||||
const app: Express = express();
|
||||
|
||||
app.use(function(req, res, next) {
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(bodyParser.urlencoded({
|
||||
extended: true
|
||||
}));
|
||||
app.use(bodyParser.json());
|
||||
|
||||
export { app };
|
||||
|
||||
|
|
Loading…
Reference in a new issue