Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bobsled

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bobsled

a fast, simple app framework prone to violent crashes

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bobsled Build Status

i can haz framework

Like every other Rails dev teaching themselves node I decided my first project would be to write my own app framework. Since it took me a day longer to discover express than it should have I actually got it working and then unwisely built some other stuff on on top of it, so now I'm releasing it a poor attempt to justify abusing NPM as my personal code repository/dependency manager. You're welcome to use it for any purpose you see fit, but I really can't recommend that you do, it's not stable, well-tested, well-thought-out, nor, well, well-anything.

Install

npm install bobsled

or

git clone http://github.com/femto113/node-bobsled.git
cd node-bobsled
npm link

Example

var Bobsled = require("bobsled").Bobsled;

var bobsled = new Bobsled();
bobsled.routes.GET["/helloworld"] = {
  "*": function (pathinfo, request, response) {
        response.writeHead(200, {"content-type": "text/plain"});
        response.end("hello world");
      }
};
bobsled.start();

The basic use of bobsled is to construct a server and then assign a controller function to a route. Routes are structured as a nested hash of METHOD, PATH, and BASENAME. "*" serves as a wildcard for any basename that doesn't have an explicit route (but don't assume that means there's real globbing going on...). This means that in the above example the given route will match "/helloworld/foo.html", but not "/helloworld.html", that could be matched instead by {{GET["/"]["helloworld"]}}. The first argument to controllers ({{pathinfo}} in the example above) is an object containing deconstructed elements of the URL, including the parsed querystring or posted body if any.

Advanced Usage/Recipes

The default Bobsled server isn't very capable (essentially just router for http requests) but it also has no dependencies. More advanced functionality, including view templates can be enabled by passing a "recipe" to the constructor. The default recipe is available as

var recipe = require("bobsled").recipes.bobsled();

About the only redeemable features of the default recipe is that it uses the the awesomely fast doT.js template library (if it's been installed), but even that it perverts with ASP style delimiters (<% %>) instead of mustache.

Changes

  • 0.2.1 fixed a bug with routes for the root (/) directory (thanks to @philion)
  • 0.2.0 added setuid/setgid functionality (allows downgrade of privilege after starting on restricted port)

TODO

  • more recipes, document recipe creation
  • more/better tests

FAQs

Package last updated on 08 Mar 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc