- Notifications
You must be signed in to change notification settings - Fork1
coderoshi/webmachine-nodejs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a Webmachine toolkit for NodeJS, inspired by the original ErlangWebmachine andRuby port. Thanks also to Nodemachine for some test scenarios.
The easiest way to get started is to includewebmachine
npm project intopackage.json
.
{"name":"wmtest","version":"1.0.0","dependencies": {"webmachine" :"~>0.0.3" }}
From there, create a webmachine resource. The same functions that can be overridden in other webmachine implementations can be done here, the only difference is that the function names are a JavaScripty camel case style, rather than underscore seperated.
Here is a simple app that adds a root ("/"
) resource to the service running on port3000
. You can add as many resources as you need. Routes can be an array, and also conform to Sinatra rules (eg./users/:uid
).
varwm=require('webmachine');varroot={route:"/",toHtml:function(req,res,next){next("<html><h1>Hello World</h1></html>");}};wm.add(root);wm.start(3000,'0.0.0.0');
If you run into issues, you can trace the output. It will present a list of steps taken to arrive at the given response.
wm.trace(true);
The output might not make a lot of sense without this chart, the steps are the decision points.
About
Webmachine HTTP Toolkit for NodeJS
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.