2022-02-15 01:03:22 +01:00
|
|
|
const express = require('express')
|
2022-02-24 12:57:21 +01:00
|
|
|
const fs = require('fs');
|
2022-02-15 01:03:22 +01:00
|
|
|
|
2022-02-24 12:57:21 +01:00
|
|
|
const dir = '/home/static';
|
2022-02-15 01:03:22 +01:00
|
|
|
const app = express();
|
|
|
|
|
|
|
|
app.use((req, res, next) => {
|
2022-02-24 12:57:21 +01:00
|
|
|
let tStart = new Date();
|
2022-02-15 01:03:22 +01:00
|
|
|
next()
|
2022-02-24 12:57:21 +01:00
|
|
|
let time = new Date() - tStart
|
|
|
|
console.log(`${req.method} ${res.statusCode} ${res.statusMessage} ${req.url} [${time}ms]`)
|
2022-02-15 01:03:22 +01:00
|
|
|
})
|
2022-02-24 12:57:21 +01:00
|
|
|
app.use(express.static(dir))
|
|
|
|
|
|
|
|
console.log('-------------- Files --------------')
|
|
|
|
fs.readdirSync(dir).forEach(file => {
|
|
|
|
console.log(file);
|
|
|
|
});
|
|
|
|
console.log('-----------------------------------')
|
2022-02-15 01:03:22 +01:00
|
|
|
|
|
|
|
app.listen(80)
|
|
|
|
console.log("Started Server on Port 80")
|