-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
32 lines (27 loc) · 841 Bytes
/
server.js
File metadata and controls
32 lines (27 loc) · 841 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
30
31
32
'use strict';
const cookieParser=require("cookie-parser");
const express = require('express');
const bodyParser = require("body-parser");
// Constants
const PORT = process.env.PORT || 8080;
const HOST = '0.0.0.0';
// App
const app = express();
app.use(bodyParser.json());
app.use(cookieParser());
app.use("/reset-danger-danger-danger",require("./restartDatabase"))
app.use("/",require("./src/routes"))//catches all requests. ./routes is an Express router
app.use(express.static("public"))//catches all requests. ./routes is an Express router
//else:
app.use(function(req,res,next) {
var err = new Error("page not found: "+req.url);
err.status=404;
next(err);
});
/*
app.get('/', (req, res) => {
res.send('Hello world\n'+sumar(2,3));
});
*/
console.log(`Running on http://${HOST}:${PORT}`);
module.exports=app.listen(PORT, HOST);