node ap.js機能しない解決方法
11229 ワード
In Express 3.0、you normally would use ap.co.nfigre(or ap.use()to set up the required middleware you need.Those middleware you specifed are to to to with Express 3.0.
e.g.
The
これが正しく起動する方法は?
e.g.
var express = require('express');
var routes = require('./routes');
var user = require('./routes/user');
var http = require('http');
var path = require('path');
var app = express();
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.compress());
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
In Express 4.0 however,all middleware have been removed so that they can be mantained and up date independently from the core Express(except the static middleware),thus the need to cared separate atel.appyou.The
bin\
directory serve as a location where you can define your various startup scripts,the www
is an example on how it shoult look s like、ultimati y you could have startup script like test
、 stop
or restart
etc.Having this structure allows you.to have different configrations without touching the ap.js.これが正しく起動する方法は?
npm start