Я использую node.js и Jade, и у меня есть index.jade в моей папке public/views, однако он не отображается, когда я запускаю сервер и перехожу на страницу, хотя все в порядке, ошибок нет, и он должен отображать. Это код в server.js:
console.log("Hello, world!");
var express = require("express")
, app = express()
, http = require("http").createServer(app);
app.set("ipaddr", "192.168.0.103");
app.set("port", 8080);
app.set("views", __dirname + "/views");
app.set("view engine", "jade");
app.use(express.static("public", __dirname + "/public"));
app.use(express.bodyParser());
app.get("/", function(request, response) {
response.send("Server is up and running");
response.render("index");
});
http.listen(app.get("port"), app.get("ipaddr"), function() {
console.log("Server up and running. Go to http://" + app.get("ipaddr") + ":" + app.get("port"));
});
А это мой index.jade:
doctype 5
html
head
link(rel='stylesheet', href='http://fonts.googleapis.com/css?family=Open+Sans')
link(rel='stylesheet', href='/css/style.css')
title Super Awesome Chatroom
body
h1 Super Awesome Chatroom
div
div.inlineBlock
span Your name:
input(type="text", value="Anonymous")#name
br
form#messageForm
textarea(rows="4", cols="50", placeholder="Share something!", maxlength=200)#outgoingMessage
input(type="button", value="Share", disabled=true)#send
div.inlineBlock.topAligned
b Participants
br
div#participants
div#messages
Все должно работать правильно, когда я перехожу к xxx.xxx.xxx:8080, он просто показывает «Сервер запущен и работает», но не показывает index.jade. Любая помощь приветствуется.