tryn
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

npm version GitHub

🚀 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

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 the Prettier class.
  • 🧩 Easy-to-use API for defining routes and handling requests.
  • Graceful server shutdown with the close 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.

⭐️ GitHub

GitHub stars

Package Sidebar

Install

npm i tryn

Weekly Downloads

30

Version

1.0.2

License

ISC

Unpacked Size

48.3 kB

Total Files

40

Last publish

Collaborators

  • nicatdcw