Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including wrapper.express with all npm packages installed. Try it out:

require("express/package.json"); // express is a peer dependency. var wrapperExpress = require("wrapper.express")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

wrapper.express v0.3.0

Monadic wrapper over Express web framework.

wrapper.express

Build Status NPM version Dependencies Status experimental

Monadic wrapper over Express web framework.

Example

var Future  = require('data.future')
var Express = require('wrapper.express')(require('express'))

var routes = [
  Express.get('/:name', function(req) {
    return new Future(function(reject, resolve) {
      resolve(Express.send('Hello, ' + req.params.name))
    })
  })
]

var app = Express.create(routes)

Express.listen(8080, app).fork(
  function (error){ throw error }
, function (addr) { console.log('Running on http://localhost:' + addr.port) }
)

Or with Sweet.js macros:

var Express = require('wrapper.express')(require('express'));

var routes = $routes(Express) {
  get('/:name'): {params:{ name }} => $do {
    html <- Future.of('Hello, ' + name)
    return Express.send(html)
  }
}

Check out the examples/ folder for more examples.

Installing

The easiest way is to grab it from NPM. If you're running in a Browser environment, you can use [Browserify][]

$ npm install wrapper.express

Documentation

Check out the [Wiki][wiki] for detailed information about the library. There's also plenty of [Examples][examples] in the examples/ folder.

You can [read the API documentation online][docs] or build it yourself:

$ git clone git://github.com/folktale/wrapper.express.git
$ cd wrapper.express
$ npm install
$ make documentation

Then open the file docs/index.html in your browser.

Platform

This library requires express@4.x and node@0.10+.

Licence

Copyright (c) 2014 Quildreen Motta.

Released under the MIT licence.

[Fantasy Land]: https://github.com/fantasyland/fantasy-land [Browserify]: http://browserify.org/ [Git]: http://git-scm.com/ [Make]: http://www.gnu.org/software/make/ [Node.js]: http://nodejs.org/ [es5-shim]: https://github.com/kriskowal/es5-shim [docs]: http://folktale.github.io/wrapper.express [wiki]: https://github.com/folktale/wrapper.express/wiki [examples]: https://github.com/folktale/wrapper.express/tree/master/examples [release]: https://github.com/folktale/wrapper.express/releases/download/v0.2.1/wrapper.express-0.2.1.tar.gz

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free