@passioncloud/http

1.0.2 • Public • Published

http

Create http request handler and http response objects.

Quick start

You can use the library to create an http response object like so:

const { HttpResponseBuilder } = require('../index.js');
const response = HttpResponseBuilder.Ok().build();

This will create below response object:

HttpResponse {
    statusCode: 200,
    headers: { 'content-type': 'application/json' },
    body: {}
}

You can also add headers and a body to your response object like so:

const response = HttpResponseBuilder.Ok()
    .addHeader('authorization': 'basic ABC')
    .setBody({ success: true })
    .build();

Readme

Keywords

none

Package Sidebar

Install

npm i @passioncloud/http

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

13 kB

Total Files

9

Last publish

Collaborators

  • gilberts