All Projects → spirit-js → Spirit

spirit-js / Spirit

Licence: isc
Modern modular library for building web applications

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Spirit

hermes-js
Universal action dispatcher for JavaScript apps
Stars: ✭ 15 (-93.78%)
Mutual labels:  functional, promise
nancy
How JavaScript Promise Works
Stars: ✭ 26 (-89.21%)
Mutual labels:  functional, promise
Farwest
Framework for building RESTful HATEOAS-driven applications.
Stars: ✭ 18 (-92.53%)
Mutual labels:  web-framework, functional
fn
A functional web framework
Stars: ✭ 34 (-85.89%)
Mutual labels:  functional, web-framework
futura
Asynchronous Swift made easy. The project was made by Miquido. https://www.miquido.com/
Stars: ✭ 34 (-85.89%)
Mutual labels:  functional, promise
Cowboy
Small, fast, modern HTTP server for Erlang/OTP.
Stars: ✭ 6,533 (+2610.79%)
Mutual labels:  web-framework, functional
Falco
A functional-first toolkit for building brilliant ASP.NET Core applications using F#.
Stars: ✭ 214 (-11.2%)
Mutual labels:  web-framework, functional
Toa
A pithy and powerful web framework.
Stars: ✭ 220 (-8.71%)
Mutual labels:  web-framework
Radwimps
君の then-then-then 世は Promise で Future
Stars: ✭ 229 (-4.98%)
Mutual labels:  promise
Radiance
A Common Lisp web application environment
Stars: ✭ 216 (-10.37%)
Mutual labels:  web-framework
Aioreactive
Async/await reactive tools for Python 3.9+
Stars: ✭ 215 (-10.79%)
Mutual labels:  functional
Luch Request
luch-request 是一个基于Promise 开发的uni-app跨平台、项目级别的请求库,它有更小的体积,易用的api,方便简单的自定义能力。
Stars: ✭ 219 (-9.13%)
Mutual labels:  promise
Min
A tiny concatenative programming language and shell
Stars: ✭ 231 (-4.15%)
Mutual labels:  functional
React Organism
Dead simple React state management to bring pure components alive
Stars: ✭ 219 (-9.13%)
Mutual labels:  promise
Popsicle
Simple HTTP requests for node and the browser
Stars: ✭ 238 (-1.24%)
Mutual labels:  promise
Sanic
Async Python 3.7+ web server/framework | Build fast. Run fast.
Stars: ✭ 15,660 (+6397.93%)
Mutual labels:  web-framework
Await Of
await wrapper for easier errors handling without try-catch
Stars: ✭ 240 (-0.41%)
Mutual labels:  promise
Cphalcon7
Dao7 - Web framework for PHP7.x,项目接洽 QQ 176013762
Stars: ✭ 237 (-1.66%)
Mutual labels:  web-framework
Core Js
Standard Library
Stars: ✭ 15,854 (+6478.42%)
Mutual labels:  promise
Scalatra
Tiny Scala high-performance, async web framework, inspired by Sinatra
Stars: ✭ 2,529 (+949.38%)
Mutual labels:  web-framework

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 http = require('http')

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)).listen(3000)

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].