
Research
/Security News
Intercom’s npm Package Compromised in Ongoing Mini Shai-Hulud Worm Attack
Compromised intercom-client@7.0.4 npm package is tied to the ongoing Mini Shai-Hulud worm attack targeting developer and CI/CD secrets.

jgloo is a local HTTP server useful to mock your backend API and speed up the client development.
This project is based on the Node framework Express. The highlights are:
npm i -D jgloo
After the installation create a folder "mock" in your project root (you can use another path and folder name if you want).
The only requirement is to create a subfolder "api" in your chosen path (e.g. "mock/api").
Now you are ready to create your first API.
To setup your first API create a new file "hello.js" in the "api" folder. The name of the file does not matter. Then insert the following snippet:
export default {
path: '/hello',
method: 'get',
callback: (req, res) => {
res.json({ message: 'Hello World!' });
},
};
This code define the GET route http://localhost:3000/hello that returns a JSON with data "{ message: 'Hello World!' }".
You are ready to run the server now.
To setup a ReST API, you have to create a new file in the "api" folder with the name you prefer and the following snippet:
export default {
path: '/user',
method: 'resource',
};
With these few rows of code will be created 6 routes:
If you want to skip any of the previous routes, you can add the "not" property:
export default {
path: '/user',
method: 'resource',
not: ['LIST']
};
The available values of the "not" property are ['LIST', 'READ', 'CREATE', 'UPDATE', 'PATCH', 'DELETE']
If you need to control the logic of your resources, you can create a custom API that read and/or write the data in the JSON database.
To achieve it create a new file in the "api" folder with the name you prefer and the following snippet:
import { getResource, setResource } from 'jgloo';
export default {
path: '/user',
method: 'post',
callback: (req, res) => {
// Get the existent resource list or instantiate it
const list = getResource('user') || [];
// Get the data of the request and add a new field
const user = req.body;
user.extraField = 'value';
// Push the new model to the list
list.push(user);
// Store the updated list in the "user.json" file
setResource('user', list);
// Return the model as JSON
res.json(user);
},
};
To add a middleware, you have to create a folder "middlewares" in your chosen root path (e.g. "mock/middlewares").
Then create a new file inside with the name you prefer and the following sample snippet:
export default function(req, res, next) {
const isAuthorized = req.get('Authorization') === 'my-token';
isAuthorized ? next() : res.sendStatus(401);
};
This sample code check for all routes if the "Authorization" header is set and it has the value "my-token".
The resources are stored in JSON files placed in the subfolder "db" of your chosen root path (e.g. "mock/db").
The default ReST API store the JSON file with the name generated by resource path replacing the slashes with the minus sign (e.g. "/auth/user" will be stored as "auth-user.json").
If you want to specify the file name of the resources, you can set it as the "name" property of the API:
export default {
path: '/my/long/path',
method: 'resource',
name: 'user',
};
With this code, the JSON file will be stored as "user.json".
To expose any static files you have to create the subfolder "static" in your chosen root path (e.g. "mock/static") and put all the resources inside it.
The static content is reachable by "http://localhost:3000/static/...". That's it.
The multipart/form-data requests are supported by default. The req.body will be filled with the right data.
The data of the uploaded files are placed in the req.files property and the files are saved in the static folder with a temporary name.
It's recommended to add the static folder in the .gitignore file.
If you want to simulate a network delay, you can add the delay property to your API configuration:
export default {
...
delay: 3 // Seconds
};
If you have a scenario where two or more paths have conflicting values, e.g.:
you can add the priority property to your API configuration:
export default {
...
priority: 2
};
The default value is 0. The api with the higher value will be used.
To run the server execute the following command in your project root:
npx jgloo
The full optional parameters are:
npx jgloo -f [FOLDER] -p [PORT] -s [STATIC_URL]
For example:
npx jgloo -f 'mock' -p 3000 -s 'static'
FAQs
The coldest mock server.
We found that jgloo 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.

Research
/Security News
Compromised intercom-client@7.0.4 npm package is tied to the ongoing Mini Shai-Hulud worm attack targeting developer and CI/CD secrets.

Research
Socket detected a malicious supply chain attack on PyPI package lightning versions 2.6.2 and 2.6.3, which execute credential-stealing malware on import.

Research
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.