Cutwater

Cutwater

  • Docs
  • Help
  • GitHub

›API Reference

Introduction

  • Getting Started

API Reference

  • @codification/cutwater-build-core
  • @codification/cutwater-core
  • @codification/cutwater-node-core
  • @codification/cutwater-logging
  • @codification/cutwater-aws

@codification/cutwater-node-core

@codification/cutwater-node-core

A library of tools for simplifying interaction with IO and HTTP on the server-side.

Installation

Via npm:

npm install @codification/cutwater-node-core

Via yarn:

yarn add @codification/cutwater-node-core

Documentation

  • Release Notes
  • API Documentation

Quick Start Guide

Http

Note: The http related functions are designed to simplify aspects of working with the http module in Node.js

import { HttpUtils } from '@codification/cutwater-node-core';

const LOG = LoggerFactory.getLogger();
const response = magicalHttpRequestFunction();
if(HttpUtils.isResponseOk(response)){
  HttpUtils.toBodyText(response).then(
    bodyTxt => {
      LOG.info('The body text was: %s', bodyTxt);
    }
  ).catch(
    err => {
      LOG.error('Oops! Problem reading the body: %j',err);
    }
  )

  const nextRequestHeaders = HttpUtils.mergeHeaders(response.headers,{'x-custom-header':'Custom Value'},true);
  // Will add the 'x-custom-header' to the received headers, or overwrite if it already exists.
}

Classes

  • HttpUtils
  • IOUtils

← @codification/cutwater-core@codification/cutwater-logging →
  • Installation
  • Documentation
  • Quick Start Guide
    • Http
    • Classes
Cutwater
Docs
Getting Started
Community
Stack Overflow
More
GitHubStar
Copyright © 2019 Codification.org