Created
February 18, 2018 16:05
-
-
Save vickonrails/85665705de411eb40cab2dd71b67195c to your computer and use it in GitHub Desktop.
This file contains 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
//requiring express and handlebars | |
//.create() method configures handlebars. We’ll explain that in a while | |
const express = require('express'), | |
hbs = require('express-handlebars').create({defaultLayout: 'main', extname: 'hbs'}); | |
app = express(); | |
//set the app engine to handlebars | |
app.engine('hbs', hbs.engine); | |
app.set('view engine','hbs'); | |
//setting the port for our app to run on | |
app.set('port', process.env.PORT || 3000); | |
app.get('/',(request,response)=>{ | |
response.render('home',{title: 'HOME'}); | |
}); | |
//setting the app port | |
app.listen(3000,()=>console.log(‘Express server started at port 3000’)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment