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