1
當我捉迷藏服務器無法得到顯示上運行的服務器無法GET /錯誤出來
/// Module dependencies.
var application_root = __dirname,
express = require("express"), //Web framework
path = require("path"), //Utilities for dealing with file paths
mongoose = require('mongoose'); //MongoDB integration
//Create server
var app = express.createServer();
// Configure server
app.configure(function() {
app.use(express.bodyParser()); //parses request body and populates req.body
app.use(express.methodOverride()); //checks req.body for HTTP method overrides
app.use(app.router); //perform route lookup based on url and HTTP method
app.use(express.static(path.join(application_root, "public"))); //Where to serve static content
app.use(express.errorHandler({ dumpExceptions:true, showStack:true })); //Show all errors in development
});
//Start server
app.listen(4711, function() {
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
});
你希望得到什麼?描述你想要達到的目標和失敗的原因 – pfried
我只是想在服務器上http://addyosmani.github.io/backbone-fundamentals跑這裏來了我的索引鏈接,並期待主題創建一個簡單的Web服務器 – itzmeatul
@ user2887764它看起來像你沒有爲'/'指定路由。如果您收到404錯誤,這可能是原因。 – Munim