generated from nightlymania/nodejs-express-ejs
27 lines
680 B
JavaScript
27 lines
680 B
JavaScript
// Import things
|
|
const express = require('express');
|
|
const app = express();
|
|
const server = require('http').createServer(app);
|
|
const port = process.env.PORT || 3430;
|
|
|
|
// Set the templates folder for the thingy
|
|
app.set('views', __dirname + '/../Templates');
|
|
app.set('view engine', 'ejs');
|
|
|
|
// Makes it so that the Public folder mounts under /
|
|
app.use(express.static(__dirname + '/../Public'));
|
|
|
|
// Main page
|
|
app.get('/', function(req, res){
|
|
res.render('index');
|
|
});
|
|
|
|
// Simple way to expose a function
|
|
exports = module.exports = rws;
|
|
|
|
// rws = RunWebServer
|
|
function rws() {
|
|
server.listen(port, () => {
|
|
console.log('✅ Webserver is running ( %d )', port);
|
|
});
|
|
}; |