JSPM

http-rest-api

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q28511F
  • License MIT

Clean and type-safe REST-API server based on express

Package Exports

  • http-rest-api
  • http-rest-api/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http-rest-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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.

License

MIT