How to do it...

Let's create a folder called hello-server, initialize a package.json, and install Express and Jade:

$ mkdir hello-server$ cd hello-server$ npm init -y$ npm install --save express jade  

Now we'll create our server.js file:

const express = require('express')const path = require('path')const app = express()app.set('views', path.join(__dirname, 'views'));app.set('view engine', 'jade');app.get('/hello', (req, res) => {  res.render('hello', { title: 'Express' });})app.listen(3000)

Next, we'll create the views folder:

$ mkdir views  

Now we create a file in views/hello.jade, with the following content:

doctype html html   head     title= title     link(rel='stylesheet', href='/stylesheets/style.css')   body     h1= title

OK, now we're ready to profile ...

Get Node Cookbook - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.