
Security News
MCP Steering Committee Launches Official MCP Registry in Preview
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Declare your APIs instead of writing them.
Neistion comes with predefined parameter validation and sanitization, authorization and more you can think of. Supports multiple frameworks, and you can create your own framework wrapper easily.
$ npm install neistion --save
Remember to add these lines to tsconfig.json (if you are going to use decorators):
"experimentalDecorators": true,
"emitDecoratorMetadata": true
import { IncomingHttpHeaders } from "http";
import { Neistion, sandhandsProp, ExpressApp } from "neistion";
class RandomParameters {
@sandhandsProp
public min!: number;
@sandhandsProp
public max!: number;
}
const api = new Neistion(new ExpressApp(), {
routes: [
{
route: "/random",
method: "GET",
parametersSchema: "RandomParameters",
call(parameters: RandomParameters) {
const { max, min } = parameters;
return Math.floor(Math.random() * (max - min)) + min;
},
verify(headers: IncomingHttpHeaders, parameters: RandomParameters) {
return parameters.max > parameters.min;
}
}
],
debug: true,
strictPropertyCheck: true,
});
api.start(3000);
Returns the main Neistion object, which empowers the API.
This is the proxy between Neistion and your framework. Change this to change what framework is used in your API. You can easily implement your own proxy, check `src/proxy/` for that.
Currently, available options are `ExpressApp` and ~~`FastifyApp`~~
normalizeParameters
transformParameters
verify
.
{
key: String,
number: Number,
isCool: Boolean
}
or, as a Typescript class using power of decorators:
import { sandhandsProp } from "neistion";
class ApiParameterType {
@sandhandsProp
public key: string;
}
// ...,
parametersSchema: "ApiParameterType";
// Because we defined sandhandsProp decorator on property, we can just type the name. Otherwise, we should duplicat e it.
headers
and parameters
of the request, and returns one of the types above.
Use this for authentication.
verify
, but waits for the callback instead. Designed to be used with old libraries, using callbacks.Starts the API up at the given port.
Redefines the routes from scratch, depending on options.
Adds an API call to the route handlers. You do not need to `setup()` after this function.
Adds all modules inside given directory as routes to the API.
api.addRoutesFromDirectory() // uses the default path, which is /routes
Example tree structure:
- routes
- random.js
- index.js
All of the files inside `routes` directory should implement IApiRoute, otherwise an error will be thrown.
Feel free to open an issue for requests. They are welcome.
Implicit#8954
FAQs
Declare APIs instead of building them.
The npm package neistion receives a total of 1 weekly downloads. As such, neistion popularity was classified as not popular.
We found that neistion 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
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.