-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (25 loc) · 719 Bytes
/
index.js
File metadata and controls
32 lines (25 loc) · 719 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
require('dotenv').config();
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
app.use(bodyParser.json());
// app.use(async (req, res, next) => {
// console.log("Incoming request: ", req);
// console.log("\n\n\n\nres: ", res);
// next();
// });
app.get('/', async (req, res) => {
return res
.status(200)
.send('hello world');
});
// Invalid route
app.get('*', async (req, res) => {
return res
.status(404)
.send('404d');
});
const port = process.env.DEP_ENV === 'production' ? (process.env.PORT || 80) : 3000;
const server = app.listen(port, function () {
console.log('Server started on port: ', port);
})