Init node dependencies and typescript

This commit is contained in:
dario-cfpt
2019-11-26 10:11:09 +01:00
parent cd91335f44
commit 1939d88457
7 changed files with 868 additions and 1 deletions

25
server/src/index.ts Normal file
View File

@ -0,0 +1,25 @@
import * as express from "express";
import * as bodyParser from "body-parser";
import * as status from "http-status";
const app = express();
const port = 3000
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
app.use(function (req, res, next) {
// Allow client to receive the data
// from : https://enable-cors.org/server_expressjs.html
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.get('/', (req, res) => {
res.send('Hello World!');
});
app.listen(port, () => {
console.log(`Example app listening on port ${port}!`)
});