我正在尝试安装app.js
来创建HTTP服务器,但是这个版本来自旧的Express version (3.x)
,所以他安装了一个不推荐使用的版本,它使用不再有用的命令,比如{ {1}}甚至其他人,但我不知道如何将这段代码用于新版本。
我的代码:
app.js
app.configure()
layout.jade
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes');
var app = module.exports = express.createServer();
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
});
app.configure('development', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
app.use(express.errorHandler());
});
// Routes
app.get('/', routes.index);
app.listen(3000, function(){
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
});
他指出了一些错误:
500错误:C:\ Users \ Leandro Mont \ Desktop \ Lucas \ Node \ Professional Node \ my_app / views / layout.jade:1> 1 | ! 2 | HTML 3 |头4 | title = title
!!! html head title= title link(rel='stylesheet', href='/stylesheets/style.css') body!= body
已弃用,您现在必须使用!!!
我需要做些什么修改才能让它发挥作用?
答案 0 :(得分:2)
使用!!!
:
doctype
(已弃用,如错误所示)
doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body!= body