Built-in Plugins
Minima.js comes with a set of pre-built plugins to handle common web development needs. These plugins can be easily integrated into your application:
- In module files - Use
meta.plugins(recommended) - In entry files - Use
app.register()
Quick Example
typescript
// src/module.ts
import { type Meta } from "@minimajs/server";
import { cors } from "@minimajs/server/plugins";
export const meta: Meta = {
plugins: [
cors({ origin: "*" })
]
};
export default async function (app) {
app.get("/api/data", () => ({ data: "value" }));
}Available Plugins
- Body Parser: For parsing incoming request bodies (e.g., JSON, text).
- CORS: For managing Cross-Origin Resource Sharing headers.
- Express Middleware: For integrating Express.js-style middleware (Node.js only).
- Proxy: For extracting client information from proxy headers (IP, protocol, hostname).
- Route Logger: A development utility to log all registered routes.
- Graceful Shutdown: For ensuring your server shuts down gracefully.