🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@rgwch/mikrorest

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rgwch/mikrorest

A minimal REST server

Source
npmnpm
Version
0.7.0
Version published
Weekly downloads
159
-74.19%
Maintainers
1
Weekly downloads
 
Created
Source

MikroRest Server

A minimal, but fully functional REST server for NodeJS. Use for proof-of concepts, simple private servers and so on.

Install

npm i --save @rgwch/mikrorest

Use

see src/demo.ts. Run with npm run demo or npx ts-node src/demo.ts

Built-in authentication

You can use Mikrorest's built-in authorization system (of course you can use your own as well). There are two possible ways:

(1) provide a MICROREST_API_KEYS environment variable with a comma separated list of valid API-keys. The client must then send an "Authorization: Bearer <key>" header with every request.

(2) call the handleLogin() method with a route and an authentication function as parameters. If you do so, MikroRest will create a login-route at the spezified location and call the authentication function if the user POST that login route with username and passwword in the JSON Body. if the authentication function returns true, a JWT Token is created and returned to the client. Note: You must provide a MIKROREST_JWT_SECRET environment variable which gives the secret key to sign the JWT Token. The client must then include an "Authorization: Token <token>" header with every request.

API

see docs

Tests

Tests were created by Github Copilot. See tests/README.md

Limitations

No path parameters, only query parameters. Things like http://localhost:3339/user/{name}/any?/load will not work with mikrorest. Use http://localhost:3339/user/load?name=name&any=thing instead. Or use a full featured framework like Express.js or Koa.js.

Keywords

rest

FAQs

Package last updated on 09 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts