server

server

Source:
HTTP server functionality using Express.js

Classes

Router
ServerModule
ServerUtils

Type Definitions

Route

Source:
Properties:
Name Type Description
route String The name of the api (this will be used as the API endpoint)
handlers Object Object mapping HTTP methods to request handler functions. Note: Any HTTP methods not specified in `handlers` will not be exposed.
Properties
Name Type Attributes Description
post Array.<function()> | function <optional>
POST handlers for the route
get Array.<function()> | function <optional>
GET handlers for the route
put Array.<function()> | function <optional>
PUT handlers for the route
delete Array.<function()> | function <optional>
DELETE handlers for the route
Defines how an individual API route should be handled
Type:
  • Object
Example
{
  route: '/:id?',
  handlers: {
    // can be an array of middleware/handlers
    post: [beforePost, handlePostRequest, afterPost],
    // or an individual function
    get: getRequest,
    put: putRequest,
    // or an in-line function
    delete: (req, res, next) => { next(); }
  }
}