first
This commit is contained in:
parent
f6a26e7a37
commit
08af0188cd
1 changed files with 18 additions and 0 deletions
18
Backend/index.js
Normal file
18
Backend/index.js
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
const express = require('express');
|
||||||
|
|
||||||
|
const bodyParser = require('body-parser');
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
const ports = process.env.PORT || 3000;
|
||||||
|
|
||||||
|
app.use(bodyParser.json());
|
||||||
|
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||||
|
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
|
||||||
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
||||||
|
next();
|
||||||
|
} );
|
||||||
|
|
||||||
|
app.listen(ports, () => console.log(`Listening on ports ${ports}`));
|
||||||
Loading…
Add table
Add a link
Reference in a new issue