How to load multiple routes in node.js in a .jade

0

Is there any way to load multiple routes within a same .jade file, for example:
I can have a /menu route, another /header , another /clientes , when calling the /clientes route I give res.render('clientes') and call all three in a single file, type:

html
  body
    [Inclui a rota /header]
    [Inclui a rota /menu]
    [faz a lógica da tela de clientes]
    
asked by anonymous 26.09.2017 / 12:55

1 answer

0

An example with 2 files:

File layout.pug :

html
  head
    title O meu site
    // etc...
  body
    block bodyPagina

File contactos.pug

extends ./layout.pug

block bodyPagina // aqui continuas o conteúdo do body definido no layout
  h1 Olá mundo!
  p Hoje está um lindo dia!

The file to be called by express in res.render should always be the most specific page, in this case contactos.pug .

Note: I'm using the .pug extension because Jade has been replaced by the Pug .

    
26.09.2017 / 13:00