Skip to content

Instantly share code, notes, and snippets.

@kunxin-chor
Created June 6, 2022 03:42
Show Gist options
  • Save kunxin-chor/f7baf3f63edefd9e7e969c4138eb1b42 to your computer and use it in GitHub Desktop.
Save kunxin-chor/f7baf3f63edefd9e7e969c4138eb1b42 to your computer and use it in GitHub Desktop.
TGC 18 Express Boilerplate
const express = require('express');
const hbs = require('hbs');
const waxOn = require('wax-on');
let app = express(); //create the express application
app.set('view engine', 'hbs'); // inform express that we are using hbs as the view engine
waxOn.on(hbs.handlebars); // enable wax-on for handlebars (for template inheritance)
waxOn.setLayoutPath('./views/layouts') // inform wax-on where to find the layouts
app.use(express.urlencoded({
'extended':false // for processing HTML forms usually it's false because
// HTML forms are usually quite simple
}))
// routes
app.get('/', function(req,res){
res.send("hello world")
})
app.listen(3000, function(){
console.log("server started");
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment