Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

122
Vistas
Pug - unable to get past step 1 of a boilerplate

total noob question but I cannot find any solutions to this sorry so last resort is to ask here.

I am trying to learn pug. Have created a boilerplate project and unable to render index page. Ive searched and read as much as I can but all I get is 'Error parsing body of the with expression' error. The index.js looks as simple as follows but stopping me in my tracks:

var express = require('express');
var router = express.Router();

// GET home page. 
router.get('/', (req, res) => {
  res.render('index', { title: 'Express' });
});

module.exports = router;

if anyone can provide a one liner to point me in the right direction to resolve this and keep rolling on my pug and nodejs journey I'd really appreciate it. Pug is appearing very difficult at this stage despite all the raving about it :/

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I have checked one of my old projects. You can try something like this:

Install pug:

$ npm install pug --save

Then set up the app:

const express = require('express')
const app = express()
const port = 3000

// you don’t have to specify the engine or load the template engine module in your app; 
// Express loads the module internally, as shown below (for the above example).

app.set('view engine', 'pug')

// views, the directory where the template files are located
// This defaults to the views directory in the application root directory.

app.set('views', './views')


app.get('/', (req, res) => {
  res.render('index', { title: 'Hey', message: 'Hello there!' })
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})

Example pug file:

html
  head
    title= title
  body
    h1= message

Using template engines

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda