Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@agreed/server
Advanced tools
Agreed mock server
agreed-server
is a mock server based on agreed
.
This module provides CLI executable command and 2 programmable interface.
If you want to use agreed
as mock, you would be better to install agreed-server
.
$ npm install agreed-server --save-dev
Usage as CLI
$ agreed-server --path ./test/agreed.json --port 10101
$ agreed-server --path ./test/agreed.json --port 10101 --hot false
Usage as programming
const agreedServer = require('agreed-server');
const server = agreedServer({
path: 'agreed/agreed.json',
port: 3001,
static: './static', // serve files from ./static
staticPrefixPath: '/public',
}).createServer();
Usage as Express pure server
const agreedServer = require('agreed-server');
const { app, createServer } = agreedServer({
path: 'agreed/agreed.json',
port: 3001,
static: './static', // serve files from ./static
staticPrefixPath: '/public',
middlewares: [
logger,
perfTool,
secureHeaders,
],
defaultRequestHeaders: {
'x-forwarded-for': 'nginx'
},
defaultResponseHeaders: {
'access-control-allow-origin': '*'
},
});
app.use(someGoodMiddleware);
app.use((err, req, res, next) => {
res.statusCode = 500;
res.send(`Error is occurred : ${err}, you should see log`);
});
const server = createServer(app);
Usage as notification event
module.exports = [
{
request: {
path: '/messages',
method: 'POST',
body: {
message: '{:message}'
},
values: {
message: 'test',
},
},
response: {
body: {
result : '{:message}'
},
values: {
message: 'test',
},
// add notify property for notification
notify: {
body: {
message: 'message! {:message}'
}
}
},
},
]
const agreedServer = require('agreed-server');
const { app, createServer, notifier } = agreedServer({
path: 'agreed/agreed.json',
port: 3001,
static: './static', // serve files from ./static
staticPrefixPath: '/public',
middlewares: [
logger,
perfTool,
secureHeaders,
],
defaultRequestHeaders: {
'x-forwarded-for': 'nginx'
},
defaultResponseHeaders: {
'access-control-allow-origin': '*'
},
});
notifier.on('message', (data) => {
console.log(data) // { message: 'message! hoge' }
});
app.use(someGoodMiddleware);
app.use((err, req, res, next) => {
res.statusCode = 500;
res.send(`Error is occurred : ${err}, you should see log`);
});
const server = createServer(app);
FAQs
agreed server
We found that @agreed/server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.