littlelink-server/app.js
2021-08-11 20:16:24 -05:00

26 lines
773 B
JavaScript

require('dotenv').config()
const express = require('express')
const helmet = require("helmet");
const morgan = require('morgan')
const compression = require('compression')
const app = express();
app.use(
helmet.contentSecurityPolicy({
useDefaults: true,
directives: {
"img-src": '* data:', // this is needed to load images off site
upgradeInsecureRequests: false, // you should use SSL, this is disabled for internal use
},
})
);
app.use(morgan('combined'));
app.use(express.static('www'));
app.use(compression())
const server = app.listen(process.env.PORT || 3000, () => {
const host = server.address().address
const port = server.address().port
console.log('Express app listening at http://%s:%s', host, port)
})