
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@rgwch/mikrorest
Advanced tools
A minimal, but fully functional REST server for NodeJS. Use for proof-of concepts, simple private servers and so on.
npm i --save @rgwch/mikrorest
see src/demo.ts. Run with npm run demo or npx ts-node src/demo.ts
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.
see docs
Tests were created by Github Copilot. See tests/README.md
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.
FAQs
A minimal REST server
The npm package @rgwch/mikrorest receives a total of 157 weekly downloads. As such, @rgwch/mikrorest popularity was classified as not popular.
We found that @rgwch/mikrorest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.