PUDA is a backend library that provides basic tools to create APIs. It’s a fast, unopinionated, and minimalist library for Node.js.
- 🚀 Feature 1 – Consists of a file-based router
- 🔌 Feature 2 – Middleware support
- 📦 Feature 3 – Built-in body parser
- 🔒 Feature 4 – Has built-in type safety
- 😄 Feature 5 – Easy to use and user-friendly
To install PUDA.TS, run the following:
npm install puda.ts
Example usage:
import { Server, initializeRouter } from "puda.ts";
const router = initializeRouter("./<name of your folder for routes>");
const server = new Server(router);
server.start(PORTNUMBER, () => console.log("Server running at http://localhost:PORTNUMBER"));PUDA.TS uses a file-based API router where each file in your directory is automatically mapped to a route. There’s no need to manually define routes in a configuration file.
- Make sure you have TypeScript and Node.js installed.
- Also ensure ts-node is installed globally.
Add the following script to your package.json:
"scripts": {
"start": "npm link puda.ts && npx ts-node-dev --watch --respawn --clear route.ts"
}
Once added, simply run the script to start the server, and you're good to go!
import { Request, Response } from 'puda.ts';
export default function GET(req: Request, res: Response): void {
res.send(200, "hello mom");
}