Skip to content

Instantly share code, notes, and snippets.

@vickonrails
Created February 18, 2018 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vickonrails/85665705de411eb40cab2dd71b67195c to your computer and use it in GitHub Desktop.
Save vickonrails/85665705de411eb40cab2dd71b67195c to your computer and use it in GitHub Desktop.
//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