-
Notifications
You must be signed in to change notification settings - Fork 0
MikeKlemarewski edited this page Jun 19, 2012
·
17 revisions
npm install express
Create a file called package.json
{
"name":"demo-application-name"
, "author":"Izzak Schroeder <[email protected]>"
, "version":"0.0.1"
, "main": "index.js"
, "dependencies":{
"express":">=2.5.10"
}
}
npm install
for more info, type
npm help
or visit: http://npmjs.org/doc/json.html
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('./demo-application-name'),
server = require('express').createServer();
server.use('/izaak', yourServer);
server.listen(8888);
rename the folder to the name in your package.json
in this case, use demo-application-name
, move test.js out side the folder.
npm adduser
just follow the guides and should be good
go into your module folder
type
npm publish
go up one level
npm install demo-application-name
now you can var Server = requare("demo-application-name")
in your application
-
change the version to a higher level
-
then use
npm publish
again.