Answer the question
In order to leave comments, you need to log in
How to correctly specify the path to the view?
Whole code:
var express = require('express');
var http = require('http');
var handlebars = require('express-handlebars').create({defaultLeyout: 'main'});
var app = express();
var server = http.createServer(app);
app.engine('handlebars', handlebars.engine);
app.set('view engine', 'handlebars');
app.get('/', function(req, res) {
res.render('home');
});
app.get('/about', function(req, res) {
res.render('about');
});
app.use(function(req, res) {
res.status(404);
res.render('404');
});
app.use(function(err, req, res, next) {
console.error(err.stack);
res.status(500);
res.render('500');
});
server.listen(3000, function() {
console.info("Express server on port 3000");
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question