Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Webmachine HTTP Toolkit for NodeJS

NotificationsYou must be signed in to change notification settings

coderoshi/webmachine-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

Usage

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp