@valora/http-handler
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@valora/http-handler

Handle logging and errors in your Google Cloud Function HTTP endpoint implementations.

Development

Install dependencies:

yarn

Run tests:

yarn test

Using

Add @valora/http-handler:

yarn add @valora/http-handler

Define your HttpFunction:

import {
  HttpFunction,
  Request,
  Response,
} from '@google-cloud/functions-framework/build/src/functions'
import { createLogger } from '@valora/logging'
import { asyncHandler } from '@valora/http-handler'

// Any Bunyan logger
const logger = createLogger()

const requestHandler: HttpFunction = async (req: Request, res: Response) => {
  res.status(200).send({ message: 'hello' })
}

const export helloCloudFunctionHandler = asyncHandler(requestHandler, logger)

Readme

Keywords

none

Package Sidebar

Install

npm i @valora/http-handler

Weekly Downloads

1,605

Version

0.0.1

License

Apache-2.0

Unpacked Size

17.6 kB

Total Files

8

Last publish

Collaborators

  • satishr
  • valora-bot
  • jeanregisser
  • jh2oman
  • dievazqu
  • jophish
  • caj-valora
  • sbw