nodejsでハンドルバーを使用しようとすると、このエラーが発生します "TypeError:Object function app(req、res){app.handle(req、res);} has nomethod'register'"。以下はnodejsのコードです。NodeJS + Express + Handlebarsのコピーペーストであるため、同じコードが他の人にも機能しているようです-ビュー「index.html」を見つけることができませんでした。PS私はnodejsを初めて使用し、その感触をつかもうとしていて、すでにハンドルバーに慣れています。
//Load Modules
var express = require('express');
var handlebars = require('handlebars');
var app = express();
// Configuration
app.configure( function() {
app.register('.html', handlebars);
app.set('views', __dirname + '/');
app.set('view engine', 'handlebars');
app.set("view options", { layout: false });
});
// Routes
app.get('/:first/:last', function(req, res) {
var data = {title:req.param.first + " " + req.param.last};
res.render("template/profilecard.html", data);
});
app.listen(3000);
console.log("NodeJS Server Started");