
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
upstream-api
Advanced tools
This creates a locally hosted upstream API, for use in testing.
const needle = require('needle');
const { startServer } = require('upstream-api');
const config = require('testapi-config.json');
startServer(config);
const res = await needle('get', 'http://localhost:8000/test');
// res.status: 200
// res.headers: { 'x-correlation-id': 'abc123' }
// res.body: {
// success: true,
// foo: 'bar'
// }
These are the possible configuration options:
name | description | example | required |
---|---|---|---|
port | The port to host the server on | 8000 | yes |
endpoints | An array of endpoints to host on the server | see full example | yes |
endpoints[n].path | The path (without '/') of the endpoint | 'test' | yes |
endpoints[n].method | The method of the endpoint | 'get' | yes |
endpoints[n].status | The statusCode to be returned | 200 | yes |
endpoints[n].delay | The delay (in ms) of the endpoint | 200 | no |
endpoints[n].body | The response body to be returned | { foo: 'bar' } | no |
endpoints[n].headers | An array of headers to be set on the response | [{ 'x-correlation-id': 'abc123' }] | no |
{
"port": 8000,
"endpoints": [
{
"path": "test",
"method": "get",
"status": 200,
"delay": 200,
"body": {
"success": true,
"foo": "bar"
},
"headers": [
{ "x-correlation-id": "abc123" }
]
}
]
}
FAQs
Easily create static upstream dummy APIs for use in testing.
We found that upstream-api 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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.