Ask a question about jade publishing to online browser access.

  node.js, question

The local jade is through node.

app.set(‘views’, path.join(__dirname, ‘www/html’));
app.set(‘view engine’, ‘jade’);

Can be accessed in the browser

Can you tell me how a browser can access jade files when publishing online?

By what means? Does anyone know?

Judging from your settings, the display is hope.jadeThe expression of template inside is “evaluated” when the server responds to the request, similar to the following expression:

p you have #{num} friends

First, browsers cannot directly access thesejadeFiles and paths that browsers can access are all routes that you define. It looks like you are usingexpressThe framework defines routes in a way like this:

app.get('/hello', function (req, res) {
 res.render('index', { num: 10 });
 });

When you enter in the browser insidehttp://xxxx/helloAfter that,expressThis route is entered.renderAfterindexTemplate from inside#{num}It is replaced by10, and then sent to the browser.