Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
innots is a wrapper around koa framework and some popular koa middlewares for quick app init and bootstrap.
First of all module is designed to use with typescript and it's async await implementation but you can also use it with plain javascript.
import {InnotsApp, Context} from 'innots';
const app = new InnotsApp({
port: 9080
});
app.route('post', '/test', async (ctx: Context, next: () => any): Promise<void> => {
ctx.body = 1;
await next();
});
app.bootstrap().then(() => {
console.log('Server started');
});
You can also define validation middleware in route method (validation is powered by joi library):
app.route(
'get',
'/foo,
((joi) => {
return joi.object().keys({
testField: joi.string().trim().email().required(),
testQueryField: joi.number().integer()
});
}),
async (ctx: Context, next: () => any): Promise<void> => {
// you can access your data by ctx.validatedData (.camelCase or .originalCase) parameter
await next();
})
);
Constructs new http server (powered by koa framework) with pre-defined built in router and middlewares.
An object for configuring built in middlewares.
{
host?: string; // listening host, e.g. 'localhost'
port: number; // listening port
jwt?: { // config for jwt middleware (jwt middleware is enabled if config exists)
secret: string; // jwt secret
publicPath: string; // regexp for public paths (not protected by jwt)
prefix?: string; // prefix before token in auth header (e.g JWT in "JWT <token>", or "Bearer" in "Bearer <token>")
};
cors?: { // CORS is enabled by default, you can edit it by providing this config param
enabled: boolean; // enable/disable CORS
origin: string; // Access-Control-Allow-Origin header
credentials: string; // Access-Control-Allow-Credentials header
};
userAgent?: boolean; // Enable or disable userAgent processing middleware
enableLogMiddleware?: boolean; // Enable or disable request info logging middleware
}
An instance of koa-router (you can use it if you don't want to use built in router)
An object with your own custom implementations if middlewares (if you don't want to use built in middlewares):
{
bodyParser?: Middleware; // bodyParser middleware - defaults to koa-bodyparser
log?: Middleware;
error?: Middleware;
jwt?: Middleware;
cors?: Middleware;
userAgent?: Middleware;
success?: Middleware;
}
Defines middleware for processing request.
app.route(
'get',
'/foo,
async (ctx: Context, next: () => any): Promise<void> => {
ctx.body = true
await next();
})
);
You can also make validation middleware here:
app.route(
'get',
'/foo,
((joi) => {
return joi.object().keys({
testField: joi.string().trim().email().required(),
testQueryField: joi.number().integer()
});
}),
async (ctx: Context, next: () => any): Promise<void> => {
// you can access your data by ctx.validatedData parameter
await next();
})
);
Starts your app with defined routes and middlewares.
FAQs
Core ecom rnd lib
The npm package innots receives a total of 7 weekly downloads. As such, innots popularity was classified as not popular.
We found that innots demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.