New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

easy-api

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-api

Super easy promise-based api declaration

Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
6
-14.29%
Maintainers
1
Weekly downloads
 
Created
Source

easy-api

Super easy promise-based api declaration.

build status

Install

npm install --save easy-api

Usage

Declaring route and using handlers is super easy

var easyApi = require('easy-api')
easyApi()
    .get(
        '/some/object/:someParameter/:someOtherParameter',
        function(someParameter, someOtherParameter) {
            return doAnythingNotPromisified(someParameter, someOtherParameter);
            // or...
            return doAnythingPromisified(someParameter, someOtherParameter);
        }
    )
    .post(
        '/some/object',
        function(label, content, catName) {
            return createObjectHoweverYouWant(label, content, catName);
        }
    )
    .start(4567)

No need to deal with request and response objects, just declare named parameters in the route and you will get them as parameter in the handler.

Get

easyApi().get(
    '/object/:foo/sub-object/:bar',
    function(bar, foo) {
        // ...
    }
)

Handler function can return either a promise or a value.

Post

easyApi().post(
    '/object/:foo/sub-object',
    function(barName, foo) {
        // ...
    }
)

To get the correct value for barName parameter, it must be included in the payload in the call.

Tests

npm test

build status

Keywords

easy

FAQs

Package last updated on 31 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts