🚀 Tryn
Tryn is a lightweight and flexible web server module for Node.js. It allows you to quickly build and handle HTTP servers with ease.
👌 Updates
- Get Updates from GitHub
✨ Features
🌐 Handles HTTP requests and routes them to the corresponding handlers.📡 Supports GET, POST, DELETE, PATCH, and PUT methods.🚦 Middleware support for extending the server's functionality.💅 Response formatting using thePrettier
class.🧩 Easy-to-use API for defining routes and handling requests.⚡ Graceful server shutdown with theclose
method.
📦 Installation
You can install Tryn using npm:
npm install tryn
yarn add tryn
🚀 Usage
Here's a basic example of how to use Tryn:
import { Server, Prettier, Logger } from 'tryn';
const server = new Server({ port: 8080, prettier: new Prettier() });
server.use(new Logger().log) // if you want to use logger
server.get('/', (req, res) => {
res.json({ message: 'Hello, world!' });
});
You can define routes using the server's methods (get
, post
, delete
, patch
, put
), and you can also add middleware functions to extend the server's functionality using the use
method.
🤝 Contributing
Contributions are welcome! If you have any suggestions, improvements, or bug fixes, feel free to open an issue or submit a pull request.
📄 License
This project is licensed under the ISC License.