Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
/ unicore Public archive

Standard batteries-included Ackee suit for an API Core.

License

Notifications You must be signed in to change notification settings

AckeeCZ/unicore

Repository files navigation

DEPRECATION NOTICE

This package is no longer maintained.

Unicore

Based on this template

Build Status Coverage Maintainability Vulnerabilities Dependency Status Dev Dependency Status

Standard batteries-included Ackee suit for an API Core.

Built on top of express and this is all you have to change.

Features

  • Promised listenAsync.
  • Destroyable server with .destroy().
  • Error processing with serializable HttpJsonError and errorHandler
  • Includes
  • Sentry error reporting support
  • Default request handlers (root with info, final handler)

Quickstart

import {
    createServer,
    jsonParser,
    defaultFinalHandler,
    defaultRootHandler,
    errorHandler,
} from 'unicore';

const server = createServer(options); // Enhanced Express app

server.use(defaultRootHandler);
server.use(errorHandler);
server.use(defaultFinalHandler);

server.listenAsync(3000)
    .then(() => console.log('Listening.'))
    .then(() => server.destroy())
    .then(() => console.log('Server shut down.'));
-> GET http://localhost:3000
<-
{
    🦄: "Greetings!",
    Application I am running: {
        name: "your-api",
        version: "1.0.0"
    },
    My time is: "2018-05-24T12:56:18.340Z",
    I am online since: "2018-05-24T12:56:13.537Z"
}

License

This project is licensed under MIT.