UNPKG

@vara/custom-logic-sdk

Version:

Server Side JavaScript SDK for Custom Business Logic

24 lines (16 loc) 587 B
/** * Created by stevenchin on 2/1/17. */ const customError = require('../services/custom-error'); const ApplicationErrors = require('../constants/application-errors.json'); const { ResourceNotFoundError } = ApplicationErrors; function resourceNotFoundMiddleware() { return function middleware(req, res) { const resourceNotFoundErr = customError(ResourceNotFoundError.name); const notFoundResponse = { error: resourceNotFoundErr, }; res.status(ResourceNotFoundError.statusCode).json(notFoundResponse); }; } module.exports = resourceNotFoundMiddleware;