Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
⚡️ A zero-dependency mock api server ⚡️
Built with ❤︎ by orels1
Hacktoberfest, mainly, but also just a search for a package like this that took me more than an hour and ultimately pointed me to Mockoon (which is great, btw, check it out). But I figured I should make this too, since I have a soft spot for cute zero-dep tools, so here we are. Hope you'll enjoy using it as much, as I did developing it.
# with npm
npm i -g puremock
#with yarn
yarn global add puremock
By default puremock will look for mockApi.json
in the project root. But you can also supply a different path (see below).
{
"GET /": {
"response": {
"status": "ok"
}
},
"GET /error": {
"status": 503,
"header": {
"x-powered-by": "mock-api-server"
},
"response": {
"error": "Internal Server Error"
}
},
"GET /articles/:name": {
"response": {
"title": "Foobar"
}
}
}
That's about it as far as configuration goes. You can supply any kind of HTTP method, set response codes and headers.
Path params are supported (with multiple levels), so you can have endpoints like /root/:param1/:param2
or /root/exact/:param1
and so on. Useful when you have a bunch of dynamic IDs your app requests, but you don't care if the same thing is being returned.
Check example.json
for references.
Default response code is 200, and the Content-Type
header is set to application/json
.
By default the server will start at localhost:3000
.
# uses a mockApi.json in the project root
puremock
# you can pass a custom path to a mock file
puremock ./mocks/api.json
# port customization is also supported
puremock --port 4000
There are still things we can add while staying lightweight and zero-dependency:
The package is auto-published with the latest tag in the package.json when merged into master
.
FAQs
A zero-dependency node mock api server
We found that puremock demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.