equipped
TypeScript icon, indicating that this package has built-in type declarations

5.0.0-rc.10 • Public • Published

Equipped


Installation

This is a Node.js module available through the npm registry. Before installing, download and install Node.js. Node.js 4.2.4 or higher is required. If this is a brand new project, make sure to create a package.json first with the npm init command. Installation is done using the npm install command:

Using npm:

npm install equipped

Using yarn:

yarn add equipped

Using CDN:

Equipped jsDelivr CDN


Basic Usage

Before use, the package must be initialized in the entry point into your application, with the required settings.

import { Instance } from 'equipped'

Instance.initialize({
    isDev: true, // Are you running in a dev environment
    appId: 'testing', // An id to identify your application
    mongoDbURI: 'mongodb://...', // A mongodb url if you want to use a database
    redisURI: 'redis://localhost:6379', // A redis url if you want to use a redis cache. Confirm all other functionality you intend to use do not depend on the cache, even if you are not using a cache directly
    ...other settings
})

After the app has been initialized, the Instance class returns a singleton that provides access to most functionality provided by Equipped

import { Instance } from 'equipped'

const appInstance = Instance.get()

To start a server

import { makeController, StatusCodes } from 'equipped'

// Aggregate all your routes into an array. This can be defined in the file or imported from your controllers etc
appInstance.server.routes = [
    {
        path: '/',
        method: 'get',
        controllers: [makeController(async () => {
            return {
                result: 'Hello world',
                status: StatusCodes.Ok
            }
        })]
    }
]

await appInstance.server.start(8080)

Readme

Keywords

none

Package Sidebar

Install

npm i equipped

Weekly Downloads

4

Version

5.0.0-rc.10

License

ISC

Unpacked Size

187 kB

Total Files

121

Last publish

Collaborators

  • kevin_deluxe