⚡️ Minimal and fast node framework
- Async first
- Middleware support
- Plugin system
- Body parsing
- @sact/cookie - Cookie parsing
- @sact/session - Sessions using redis or in-memory
- @sact/auth - Opinionated authentication
- @sact/graphql - Graphql
- @sact/shine - Shine (opinionated json-rpc api sub-framework)
API documentation are heavily lacking but generated ones by typedoc are located in each package under /docs. You can also look at the tests for each package for usage but the main server package is @sact/core
the rest are plugins for various cases, use it if you want
yarn add @sact/core
import { Sact } from '@sact/core';
const app = new Sact();
app.get('/', async () => ({ foo: 'bar' }));
async function start() {
try {
// a automatic port will be chosen for you
const { url } = await app.listen();
console.log('Server started on ', url);
} catch (error) {
console.error(error);
}
}
start();
app.use((req, res) => {
req.foo = 'bar';
console.log(`Requested route ${req.getUrl()}`);
});
app.get('/foo', async (req) => req.foo);
// register middlewares or routes here
const plugin = (app, options) => {
app.foo = 'bar';
app.use((req, res) => {
console.log(`Requested route ${req.getUrl()}`);
});
app.get('/foo', async () => app.foo);
};
app.register(plugin, {});
This framework uses https://github.com/uNetworking/uWebSockets