Socket
Socket
Sign inDemoInstall

@vtfk/responsehandlers

Package Overview
Dependencies
21
Maintainers
7
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @vtfk/responsehandlers

Handles AZF and Express responses


Version published
Weekly downloads
25
Maintainers
7
Created
Weekly downloads
 

Readme

Source

vtfk-responsehandlers

A node package for handeling Azure function and Express responses for VTFK.

Features

  • Parses and returns a property formatted errors
  • Handles sending responses for Azure Function Apps or Express
  • Uses @vtfk/logger so it can use any features it has. (Papertrail logging, etc.)
  • Report operations back to E18 if applicable

Useage example

Azure Function Apps

const { azfResponseHandler, azfErrorHandler } = require('@vtfk/responsehandlers');

module.exports = async function (context, req) {
  try {
    const data = { message: 'Hello World!' }
    return await azfResponseHandler(data, req, context);
  } catch (error) {
    return await azfErrorHandler(error, req, context);
  }
}

Express App

const { expressResponseHandler, expressErrorHandler } = require('@vtfk/responsehandlers');

router.get('/', async (req, res, next) => {
  try {
    const data = { message: 'Hello World!' }
    return await expressResponseHandler(data, req, res, next);
  } catch (error) {
    return await expressErrorHandler(error, req, res, next);
  }
})
}

FAQs

Last updated on 17 Mar 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc