service

v0.0.3arrow_drop_down
v0.0.3
v0.0.2
v0.0.1
STATUS
Passing
DOWNLOADS
1
VISIBILITY
Public
PUBLISHED
6 years ago
SIZE
695 KB
Initializes an express application running on specified port and serving specified routes
1 contributor
Install service as a package?
Copied
npm i @bit/amit.express.global.service
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
init-service (
routes:Array<Object>,
port:number
)

Initializes an express application running on specified port and serving specified routes

Example
const initService = reqiure("@bit/amit.express.global.service");
const port = 3000
const routes = [{ method: 'get', route: '/status', middleware: [(req, res) => res.ok()] }]
initService(routes, port);
Arguments
routes: Array<Object>

array of routes, example route { method: 'get’, route: '/’, middleware: [fn] }

port: number

port to run service (default 3036)

Test Summary

simple-express-service GET /_ah/health should return ‘200’

Pass

simple-express-service create custom route should return response ‘200’

Pass

simple-express-service should return 404 if route dosent exists

Pass
Help and resources