DHRMKJ / http-rest-api

NPM Package for clean REST API Server based on Express JS

Home Page:https://www.npmjs.com/package/http-rest-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

License

MIT

About

NPM Package for clean REST API Server based on Express JS

https://www.npmjs.com/package/http-rest-api

License:MIT License


Languages

Language:TypeScript 100.0%