add logging, fix title of page, revise docker compose file
This commit is contained in:
parent
d9d53290ea
commit
9deb1e3f37
15
app.js
15
app.js
@ -3,6 +3,8 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const validator = require('validator');
|
const validator = require('validator');
|
||||||
const helmet = require('helmet');
|
const helmet = require('helmet');
|
||||||
|
var figlet = require("figlet");
|
||||||
|
const morgan = require('morgan');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const PORT = 3000;
|
const PORT = 3000;
|
||||||
@ -23,6 +25,7 @@ app.use(helmet.contentSecurityPolicy({
|
|||||||
upgradeInsecureRequests: [],
|
upgradeInsecureRequests: [],
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
app.use(morgan('combined'));
|
||||||
|
|
||||||
// routes
|
// routes
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
@ -33,7 +36,7 @@ app.get('/apps', (req, res) => {
|
|||||||
fs.readFile('data/apps.json', (err, data) => {
|
fs.readFile('data/apps.json', (err, data) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
const apps = JSON.parse(data);
|
const apps = JSON.parse(data);
|
||||||
res.render('pages/apps', { title: 'Apps', apps: apps });
|
res.render('pages/apps', { title: 'Apps | modules.', apps: apps });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -90,5 +93,13 @@ app.get('/download', (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`Server is running on http://localhost:${PORT}`);
|
figlet("modules", function (err, data) {
|
||||||
|
if (err) {
|
||||||
|
console.log("Something went wrong...");
|
||||||
|
console.dir(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(data);
|
||||||
|
console.log('\x1b[36m%s\x1b[0m', `Server is running on http://localhost:${PORT}\n`);
|
||||||
|
});
|
||||||
});
|
});
|
@ -1,8 +1,12 @@
|
|||||||
services:
|
services:
|
||||||
app:
|
modules-app:
|
||||||
build: .
|
build: .
|
||||||
|
container_name: modules-app
|
||||||
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
command: ["node", "app.js"]
|
command: ["node", "app.js"]
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
@ -20,7 +20,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ejs": "^3.1.10",
|
"ejs": "^3.1.10",
|
||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
|
"figlet": "^1.8.0",
|
||||||
"helmet": "^8.0.0",
|
"helmet": "^8.0.0",
|
||||||
|
"morgan": "^1.10.0",
|
||||||
"tailwindcss": "^3.4.17",
|
"tailwindcss": "^3.4.17",
|
||||||
"validator": "^13.12.0"
|
"validator": "^13.12.0"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user