-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.js
More file actions
29 lines (23 loc) · 828 Bytes
/
server.js
File metadata and controls
29 lines (23 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const express = require('express');
const app = express();
app.use(express.json());
app.use(express.urlencoded({extended: true}));
const Api = require('./api');
Api(app);
// app.all('*', function(req, res, next) {
// res.header("Access-Control-Allow-Origin", "*");
// res.header("Access-Control-Allow-Headers", "X-Requested-With");
// res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
// res.header("X-Powered-By",' 4.0.0');
// res.header("Content-Type", "application/json;charset=utf-8");
// next();
// });
app.get('/', function (req, res) {
console.log("Hello World");
res.send('Hello World');
});
const server = app.listen(8888, function () {
const host = server.address().address;
const port = server.address().port;
console.log("node start http://%s:%s", host, port);
});