From 158875b0c708a51a8f47c226879f9beeee58fc4f Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 30 Jan 2019 23:51:25 +0100 Subject: New base --- src/app.mjs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/app.mjs (limited to 'src/app.mjs') diff --git a/src/app.mjs b/src/app.mjs new file mode 100644 index 0000000..2903c58 --- /dev/null +++ b/src/app.mjs @@ -0,0 +1,24 @@ +'use-strict'; + +const express = require('express'); +const mustache = require('mustache-express'); +const path = require('path'); + +const app = express(); + +app.engine('html', mustache()); +app.set('view engine', 'html'); +app.set('views',path.join(__dirname, 'views')); + +app.use(express.static('default')); +app.use(express.static('static')); + +app.get('/', (req, res) => { + res.render('index.html', {yourdata: 'Hello from Mustache Template'}); +}); + +const server = app.listen(8100, () => { + const host = server.address().address; + const port = server.address().port; + console.log(`[${new Date()}] > App listening at http://%s:%s`, host, port); +}); -- cgit v1.2.3-54-g00ecf