added logging
nclazz/static-webserver-docker/pipeline/head This commit looks good
Details
nclazz/static-webserver-docker/pipeline/head This commit looks good
Details
parent
6861cf26d9
commit
441fa7efff
13
index.js
13
index.js
|
@ -1,11 +1,22 @@
|
||||||
const express = require('express')
|
const express = require('express')
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const dir = '/home/static';
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
|
let tStart = new Date();
|
||||||
next()
|
next()
|
||||||
|
let time = new Date() - tStart
|
||||||
|
console.log(`${req.method} ${res.statusCode} ${res.statusMessage} ${req.url} [${time}ms]`)
|
||||||
})
|
})
|
||||||
app.use(express.static('/home/static'))
|
app.use(express.static(dir))
|
||||||
|
|
||||||
|
console.log('-------------- Files --------------')
|
||||||
|
fs.readdirSync(dir).forEach(file => {
|
||||||
|
console.log(file);
|
||||||
|
});
|
||||||
|
console.log('-----------------------------------')
|
||||||
|
|
||||||
app.listen(80)
|
app.listen(80)
|
||||||
console.log("Started Server on Port 80")
|
console.log("Started Server on Port 80")
|
Loading…
Reference in New Issue