Skip to content
xna2 edited this page Jun 18, 2012 · 17 revisions

install express manually

npm install express

install express using package.json

Create a file called package.json

{
    "name":"application-name"
    , "author":"Izzak Schroeder <[email protected]>"
    , "version":"0.0.1"
    , "dependencies":{
        "express":">=2.5.10"
    }
}

npm install

for more info, type

npm help

or visit: http://npmjs.org/doc/json.html

Creating a index.js for basic express framework and export it

var server = require('express').cerateServer();

server.get("/", function (request, response) {
    response.writeHead(200, {"Content-type":text / plain})
    response.end('whatever you want ');
})

module.exports = server;

Create another file called test.js, so we can load index.js into it and use it

var
    yourServer = require('./index'),
    server = require('express').createServer();

server.use('/izaak', yourServer);
server.listen(8888);
Clone this wiki locally