storona
v1.0.0
Published
Simple opinionated file-based routing for your JavaScript applications
Downloads
160
Maintainers
Readme
JavaScript backend applications tend to rely on a framework or meta-framework to handle routing and architecture. But for specific use cases in which a full framework is not necessary, developers usually have to build their own routing system from scratch or using a full-fledged wrapper. This is usually a time-consuming process that can be avoided.
For this reason, Storona was created. It is designed to be easy to use and easy to understand, with a minimal learning curve.
Here's a quick example of how to use Storona:
import express from "express";
import { createRouter } from "storona";
import { adapter } from "@storona/express";
const app = express();
createRouter(app, {
directory: "src/routes",
adapter: adapter(),
});
app.listen(3000, () => {
console.info("API running on port 3000");
});
Result
.
└─ src
├─ routes
│ ├─ directory
│ │ ├─ [fruit].get.js --> GET /v1/api/directory/:fruit
│ │ └─ index.put.mjs --> PUT /v1/api/directory
│ ├─ apple.post.ts --> POST /v1/api/apple
│ └─ index.get.jsx --> GET /v1/api
└─ index.ts
Philosophy
Storona is designed to be simple and easy to use. It is neither a complete framework nor a package for certain framework. The goal is to unify simple architecture to something that everyone can understand and use.
The idea of route design was highly inspired by the Nitro framework that uses h3 under the hood. Storona on the other hand is compatible with different kind of frameworks like Express, Fastify and grammY.
For the simplicity reason Storona supports TypeScript and JSX out-of-the-box. The transpilation of routes is handled by tsup. For more information regarding the configuration, see the Transpilation of TypeScript guide.
Documentation
For more information regarding Storona, please refer to the official documentation.