Express error and response handler when using Promises.
npm install endpoint-handler --save
express = require("express")
controller = require("./controller")
router = express.Router()
{ route } = require("endpoint-handler") router
# router.use <<middleware>>
route.get "/", controller.get
route.put "/", controller.update
module.exports = router- if you return a successful
Promise, it responds a 200 code with the json. - if you return a rejected
Promise, it responds a 500 code with the error. - if you return a
Promisethat fails with an object{ statusCode, body }, it responds astatusCodecode with thebody. - if you throw an exception synchronously, it responds a 500 or the specified error if some.
Package publishing is now handled automatically via a GitHub Action triggered on push to the main or master branches.
You can also trigger it manually from the Actions tab using the Release workflow.
The workflow supports prerelease versions (e.g., alpha, beta) through the prereleaseTag input.
commitlint was added to ensure commit messages follow the Conventional Commits standard.
Commit messages are automatically validated before each commit using Husky.
Example of a valid commit message:
feat: add login functionalityIf the format is invalid, the commit will be blocked.