Skip to content

dhershman1/octoris

Repository files navigation

Octoris Logo

NPM version License Build Status Coverage Report

Standard Js

A small and simple node server framework.

Install

npm i octoris

Usage

Create a basic server:

const { listen } = require('octoris')
const routes = require('./routes')

listen({ port: 3000 }, routes)
  .then(addr => console.log(`Server Listening on ${addr}`))
  .catch(console.error)

routes.js:

const { router, response, methods } = require('octoris')
const { send } = response
const { route, fixed, composeRoutes } = router
const { GET } = methods

function homeHandler () {
  return send(200, 'Hello Home!')
}

function aboutHandler () {
  return send(200, 'Hello About!')
}

const home = route([fixed('home')], [
  GET(homeHandler)
])

const about = route([fixed('about')], [
  GET(aboutHandler)
])

module.exports = composeRoutes({ logger: true }, [about, home])

Documentation

You can find the documentation here

Official Middleware

Here is a list of official released middleware for Octoris

Contribute

Checkout the contribute file here

Please check this file regularly as it is Subject to change and updated as the project continues to develop and grow!