Created
July 22, 2021 11:25
-
-
Save kunxin-chor/487fb53e18f7ab659e4811b9a843f056 to your computer and use it in GitHub Desktop.
Express Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import in the packages | |
const express = require('express'); | |
const hbs = require('hbs'); | |
const wax = require('wax-on') | |
let app = express(); | |
app.set('view engine', 'hbs'); | |
// Inform Express where to find static images, css and | |
// client-side (ie. browser) | |
app.use(express.static('public')) | |
// Setup Wax On (for templates with HBS) | |
wax.on(hbs.handlebars); | |
wax.setLayoutPath('./views/layouts') | |
// enable forms | |
app.use( express.urlencoded({ | |
'extended': false | |
})) | |
// ROUTES | |
app.get('/', function(req,res){ | |
res.send("Hello world"); | |
}) | |
// START SERVER | |
app.listen(3000, function(req,res){ | |
console.log("Server started") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment