All Projects → spirit-js → spirit-router

spirit-js / spirit-router

Licence: ISC License
fast router for spirit

Programming Languages

javascript
184084 projects - #8 most used programming language
go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to spirit-router

Webgo
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).
Stars: ✭ 165 (+489.29%)
Mutual labels:  router, webframework
Dotweb
Simple and easy go web micro framework
Stars: ✭ 1,354 (+4735.71%)
Mutual labels:  router, webframework
Twig
Twig - less is more's web server for golang
Stars: ✭ 98 (+250%)
Mutual labels:  router, webframework
Golf
⛳️ The Golf web framework
Stars: ✭ 248 (+785.71%)
Mutual labels:  router, webframework
ultra-router
Router for component-based web apps. Pair with React or <BYOF />.
Stars: ✭ 35 (+25%)
Mutual labels:  router
STCRouter
基于标准URL的iOS路由系统,可实现业务模块组件化,控制器之间零耦合,可实现黑白名单控制,可进行native降级到hybrid。
Stars: ✭ 19 (-32.14%)
Mutual labels:  router
ruuter
A zero-dependency HTTP router
Stars: ✭ 57 (+103.57%)
Mutual labels:  router
openwrt
OpenWrt Stable 1907 with lean's package
Stars: ✭ 55 (+96.43%)
Mutual labels:  router
tarojs-router-next
Taro 小程序路由库/自动生成带参数类型提示的路由方法/允许传递任意类型、任意大小的参数数据/同步的路由方法调用/koa体验一致的路由中间件
Stars: ✭ 166 (+492.86%)
Mutual labels:  router
shim
HTTP Handler shim for Go projects running on AWS Lambda
Stars: ✭ 64 (+128.57%)
Mutual labels:  router
framework
Lite & fast micro PHP framework that is **easy to learn**.
Stars: ✭ 110 (+292.86%)
Mutual labels:  router
router
Bidirectional Ring router. REST oriented. Rails inspired.
Stars: ✭ 78 (+178.57%)
Mutual labels:  router
amber-router
A URL Routing shard.
Stars: ✭ 16 (-42.86%)
Mutual labels:  router
ampersand-router
Clientside router with fallbacks for browsers that don't support pushState. Mostly lifted from Backbone.js.
Stars: ✭ 69 (+146.43%)
Mutual labels:  router
OpenBSDFirewall
Simple OpenBSD Home Firewall Config for ALIX Board
Stars: ✭ 41 (+46.43%)
Mutual labels:  router
Computer-Networks
GBN and SR simulation, Distance Vector Algorithm Simulation
Stars: ✭ 21 (-25%)
Mutual labels:  router
YAWAC
Yet Another Wifi Auto Connect (YAWAC) is a shell script to connect to a dataset of wireless connection and free hotspot like FreeWifi. It's works on OpenWrt.
Stars: ✭ 22 (-21.43%)
Mutual labels:  router
retil
The React Utility Library
Stars: ✭ 46 (+64.29%)
Mutual labels:  router
CRRouter
A simple and powerful router
Stars: ✭ 54 (+92.86%)
Mutual labels:  router
bs-director
[UNMAINTAINED] BuckleScript bindings to the Director router
Stars: ✭ 22 (-21.43%)
Mutual labels:  router

spirit-router

A router for spirit.

When combined with spirit, it provides a low level extensible framework (it is not a full stack batteries included framework or a boilerplate). It is meant as an alternative to Express, Koa, and Hapi.

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

It emphasizes clear separation of code between HTTP and your own code. Routes are normal javascript functions. That means a route can be as simple as:

function() { return "Hello World" }

This makes testing, re-using, and reading your code much easier, as "it's just javascript".

Features

  • Routes are just normal functions that return something. No more proprietary (req, res, next) functions. This makes it easier to test, re-use, read your routes.

  • Compatible with most Express middleware. (via spirit-express) Re-using existing code is important.

  • Error handling with then & catch. Promises are "first class". And so async/await compatible.

  • Fast, fast!. It outperforms other web frameworks (Express, Koa, Hapi). Article showing the performance difference.

Example

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

const greet = (name) => {
  return "Hello, " + name
}

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

http.createServer(adapter(app)).listen(3000)

More examples in can be found here.

Getting Started

To install: npm install spirit spirit-router

Resources for getting started:

There are a set of videos that quickly go over different topics in spirit.

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).

The code style omits ending semi-colons. It also does not use camel case. And one-liners should be avoided unless it's very clear.

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.

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].