JavaScript Makefile
Latest commit 55a3cf7 Mar 30, 2017 @hnry hnry Fix Promise warnings
Promise warnings regarding async error handling have been fixed.
`resolve_response` has been removed. `callp_response` added, which are
similar.

v0.6.0
Permalink
Failed to load latest commit information.
docs Fix Promise warnings Mar 29, 2017
spec Fix Promise warnings Mar 29, 2017
src Fix Promise warnings Mar 29, 2017
.babelrc init Jun 1, 2016
.gitignore init doc book Sep 7, 2016
.tern-project init Jun 1, 2016
.travis.yml add test coverage Jun 4, 2016
CHANGELOG.md Fix Promise warnings Mar 29, 2017
CNAME init doc book Sep 7, 2016
LICENSE.md v0.0.11 Jul 26, 2016
Makefile update docs Sep 9, 2016
README.md v0.5.0 - fix request.url to exclude query string Mar 28, 2017
book.json update docs, README Sep 11, 2016
index.js Fix Promise warnings Mar 29, 2017
package.json Fix Promise warnings Mar 29, 2017

README.md

spirit

Modern and functional approach to building web applications.

Build Status Coverage Status Join the chat at https://gitter.im/spirit-js/spirit

Why?

const {adapter} = require("spirit").node
const route = require("spirit-router")

const hello = () => "Hello World!"

const greet = (name) => `Hello, ${name}`

const app = route.define([
  route.get("/", hello),
  route.get("/:name", ["name"], greet),
])

http.createServer(adapter(app))

If we think about a web request in its simplest form, it's basically a function, it takes an input (request) and returns an output (response). So why not write web applications this way?

No more req, res. Spirit simplifies everything by abstracting away the complexity of req and res that normally resulted in impure and complex functions.

Middleware in spirit can also transform the returned response and not just the request. This is in contrast to other web libraries that can only transform the request. This is a simple idea but having this feature allows for much more DRY and expressive code.

Given the above, it's much more easier to re-use, test, and reason about your code in spirit.

Oh yea, most Express middleware works in spirit too!

Getting Started

The Handbook

Components

  • spirit is a small library for composing functions and creating abstractions. Abstractions are defined in a "spirit adapter". Currently it comes with 1 builtin, the node adapter (spirit.node) for use with node.js' http module. Eventually there will be another one written for spirit to run in the browser.

  • spirit-router is a library for routing and creating routes.

  • spirit-common is a library that provides many common http related middleware. It's purpose is to make bootstrapping a multitude of middleware that everyone will need easier.

  • spirit-express, is a library for converting most Express middleware to work in spirit.

Third Party Components

  • spirit-body is a simple body parser middleware for spirit. Alternative to using spirit-common which wraps the Express body-parser module.

Contributing

All contributions are appreciated and welcomed.

For backwards incompatible changes, or large changes, it would be best if you opened an issue before hand to outline your plans (to avoid conflict later on).

This codebase avoids using unnecessary semi-colons, camelCase and one-liners.

To run tests, use make test. This will also build changes to src/*, if you do not have make installed, you can look at the Makefile to see the steps to accomplish the task.

Credits

Spirit is heavily influenced by the design of Ring.