Core API
Closed this issue · 0 comments
dhershman1 commented
This issue may be broken down into multiples if needed
Tasks
- Core server functionality
- Hosts server on desired port
- Accepts routing setup from
routeReducer
- Gives back a new promise on startup
- HTTP create server
- Optimized route tree navigation
- Optimized startup process (Ongoing)
The core to octoris will be the primary module you get when just importing/requiring octoris like so:
const octoris = required('octoris')
This will give you a function that accepts two parameters.
Parameters
options
:Object
- The options given to octorisoptions.port
:Number
- The port number to run on
routes
:Function|Object
(Not decided Yet) - These will be the collected and built out routes octoris should listen too
There is ideas of passing a middleware array to options as well, this has not been confirmed because there is also the idea of helper functions to achieve this as well as many other things. These issues (once created) will be linked to this one at a later date
Usage
const octoris = require('octoris')
const routes = require('./routes')
octoris({ port: 8080 }, routes)
.then(() => console.log('server started!'))
.catch(console.error)