-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
37 lines (28 loc) · 986 Bytes
/
server.js
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
33
34
35
36
37
// server.js
// where your node app starts
// require('dotenv').config();
var dotenv=require('dotenv');
var compression = require('compression');
var cors = require('cors');
var express = require('express');
var nocache = require('node-nocache');
var http=require('http');
const result = dotenv.config()
if (result.error) {
throw result.error
}
console.log(result.parsed)
var app = express();
// compress our client side content before sending it over the wire
app.use(compression());
// https://github.com/mingchen/node-nocache
app.use('/manifest.json', nocache, function (request, response) {
response.sendFile(__dirname + '/public/manifest.json');
});
// http://expressjs.com/en/starter/static-files.html
app.use('/',express.static('test'));
console.log('port',process.env.PORT)
var listener = app.listen(process.env.PORT, function () {
console.info(`Node Version: ${process.version}`);
console.log('Node Server listening on port ' + listener.address().port);
});