@vtfk/responsehandlers
Advanced tools
Handles AZF and Express responses
Weekly downloads
Readme
A node package for handeling Azure function and Express responses for VTFK.
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);
}
}
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);
}
})
}
Variable | Description |
---|---|
PAPERTRAIL_HOST | Papertrail logging url |
PAPERTRAIL_TOKEN | Papertrail logging token |
RESPONSEHANDLER_LOGGER_REMOTE_ONLY_IN_PROD | Should the logger only be able to write to PaperTrails when NODE_ENV = production? |
RESPONSEHANDLER_LOGGER_REMOTE_DISABLE | Disable all remote logging |
RESPONSEHANDLER_LOGGER_LOCAL_DISABLE | Disable logging to std out |
E18_URL | E18 API URL |
E18_KEY | E18 API Key |
E18_SYSTEM | Job name |
E18_PROJECTID | Project Id |