diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/Docker-site b/Docker-site new file mode 100644 index 0000000..69653a3 --- /dev/null +++ b/Docker-site @@ -0,0 +1,13 @@ +FROM node + +ARG APP_DIR=/var/www/trash/web +RUN mkdir -p ${APP_DIR} +WORKDIR ${APP_DIR} + +COPY package*.json ./ +RUN npm ci +COPY . . + +RUN npm run build + +EXPOSE 3000/tcp \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..0ad9ee9 --- /dev/null +++ b/main.js @@ -0,0 +1,32 @@ +const express = require('express') +const util = require('util'); +const bodyParser = require('body-parser'); +const app = express() +const PORT = 3333; + +app.use(bodyParser.urlencoded({ extended: true })); +app.use(express.json()) + +const logging = (req, res, next) => { + var ip = req.ip; + console.log("------------------------------------------------------------"); + + const curData = new Date(); + console.log(curData.toISOString()) + console.log('Request from', ip); + console.log(`Request received for ${req.method} ${req.url}`); + console.log(`Request body: ${util.inspect(req.body)}`); + + next(); +}; + +app.use(logging); + +app.get('/', (req, res) => { + res.send('OK') +}) + + +app.listen(PORT, () => { + console.log(`Start on http://localhost:${PORT}`); +}) \ No newline at end of file