1.0.25 • Published 2 years ago

@vtfk/responsehandlers v1.0.25

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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);
  }
})
}

Environment variables

VariableDescription
PAPERTRAIL_HOSTPapertrail logging url
PAPERTRAIL_TOKENPapertrail logging token
RESPONSEHANDLER_LOGGER_REMOTE_ONLY_IN_PRODShould the logger only be able to write to PaperTrails when NODE_ENV = production?
RESPONSEHANDLER_LOGGER_REMOTE_DISABLEDisable all remote logging
RESPONSEHANDLER_LOGGER_LOCAL_DISABLEDisable logging to std out
E18_URLE18 API URL
E18_KEYE18 API Key
E18_SYSTEMJob name
E18_PROJECTIDProject Id
1.0.22

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.11

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago