Skip to content

Instantly share code, notes, and snippets.

@vickonrails
Created February 3, 2018 06:21
Show Gist options
  • Save vickonrails/5b3d410928c07f45cde6a78ab67ffd99 to your computer and use it in GitHub Desktop.
Save vickonrails/5b3d410928c07f45cde6a78ab67ffd99 to your computer and use it in GitHub Desktop.
const express = require('express'),
hbs = require('express-handlebars').create({defaultLayout:'main.hbs'}),
app = express();
//setting our app engine to handlebars
app.engine('hbs', hbs.engine);
app.set('view engine', 'hbs');
app.get('/',(request,response)=>{
response.render('home',{title: 'Home'});
});
app.get('/about',(request,response)=>{
response.render(‘about’,{title: ‘About’});
});
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