1.0.0 • Published 5 years ago

@itemsjs/service-http v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

ItemsJS HTTP service

NPM version NPM downloads

Installation

npm i @itemsjs/service-http --save

Usage

const express = require('express');
const app = express();

const HttpService = require('@itemsjs/service-http');

app.use((req, res, next) => {

    req.services.http = new HttpService(req, res, 'express');

    return next();
});

app.get('/:id', (req, res) => {

    res
        .status(200)
        .send({

            id: req.services.http.req.params.name,
            framework: req.services.http.framework
        });
});


app.listen(3000);

And you're good to go!

License

MIT