http-rest-api
v0.1.1
Published
Clean and type-safe REST-API server based on express
Downloads
34
Maintainers
Readme
Http Rest Api
Simple and type-safe developer oriented rest api server for Node.js.
const { HttpServer } = require("http-rest-api")
const server = new HttpServer(3000)
const api = new HttpRestApi({
method: "get",
path: "/",
handler: () => {
return { message: "Hello World" }
},
})
server.registerRestApis([api])
server.listen()
Installation
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js. version 14.0 or higher is required.
If this is a brand new project, make sure to create a package.json
first with
the npm init
command.
Installation is done using the
npm install
command:
npm install http-rest-api
You can also install by yarn:
yarn add http-rest-api
Features
- Built on top of express which gives all the flexibility, performance and robustness
- Express middleware support
- Built in typescript declarations
- Very easy and flexible to create apis
- Custom http errors
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.