mirror of
https://github.com/techno-tim/littlelink-server.git
synced 2024-11-26 06:05:34 +01:00
26 lines
773 B
JavaScript
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)
|
|
})
|