@kobotech/core-http
Utilities for supporting the making http requests
Last updated 2 months ago by ctumwebaze .
ISC · Repository · Original npm · Tarball · package.json
$ cnpm install @kobotech/core-http 
SYNC missed versions from official npm registry.

Kobo360 Core Http Library

This library provides utilities for handing http requests and responses.

Usage

Add the dependency to this library in your project's package.json in the dependencies section;

{
  "dependencies": {
    "@kobotech/core-http": "1.0.0"
  }
}

Run npm install to install the defined dependencies;

To use the library in your project.

const coreHttp = require("@kobotech/core-http");

Respond with an error message

const data = "content";
const errorMessage = "error";
const httpStatus = 401;
coreHttp.sendErrorJsonResponse(response, data, errorMessage, httpStatus);

this call will write on the response object a json payload as seen below;

{ "success": false, "message": error, "data": "content" }

The data could be any type, whether string or array or even an object as long as it's supported by json.

Current Tags

  • 1.0.6                                ...           latest (2 months ago)

7 Versions

  • 1.0.6                                ...           2 months ago
  • 1.0.5                                ...           3 months ago
  • 1.0.4                                ...           3 months ago
  • 1.0.3                                ...           3 months ago
  • 1.0.2                                ...           3 months ago
  • 1.0.1                                ...           4 months ago
  • 1.0.0                                ...           4 months ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 7
Last Month 9
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |