Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sherbolotarbaev/deno-hono
🦖 Fastest API build with Deno 2.0 & Hono.js
https://github.com/sherbolotarbaev/deno-hono
deno-2 honojs zod zod-validation
Last synced: about 1 month ago
JSON representation
🦖 Fastest API build with Deno 2.0 & Hono.js
- Host: GitHub
- URL: https://github.com/sherbolotarbaev/deno-hono
- Owner: sherbolotarbaev
- Created: 2024-10-16T23:52:58.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-10-17T01:15:16.000Z (about 1 month ago)
- Last Synced: 2024-10-19T00:31:08.528Z (about 1 month ago)
- Topics: deno-2, honojs, zod, zod-validation
- Language: TypeScript
- Homepage: https://deno-hono-sher.deno.dev
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🦖 Fastest API with Deno 2.0 & Hono.js
This project showcases a performant API built with **Deno 2.0** and **Hono.js**. It includes message handling, caching, validation, and security features.
## 🚀 Features
- **Deno 2.0**: A modern, fast JavaScript/TypeScript runtime.
- **Hono.js**: Ultra-fast web framework for handling requests.
- **Message Caching**: Uses a cache to store messages with timestamps.
- **Validation**: Validates request body using `Zod`.
- **Security**: Secure headers for enhanced API security.
- **CORS & Logging**: CORS and request logging are enabled for better API handling.## 🛠️ Installation
1. Install [Deno](https://deno.land) (if not already installed):
```bash
deno --version
```2. Clone the repository:
```bash
git clone https://github.com/sherbolotarbaev/deno-hono.git
cd deno-hono
```3. Run the API:
```bash
deno task dev
```The server will start on `http://localhost:999`.
## 📚 API Endpoints
- **GET /messages**: Fetch all cached messages.
Example:
```bash
curl http://localhost:999/messages
```- **POST /messages**: Add a new message to the cache. Expects a JSON body:
```json
{
"message": "Your message here"
}
```Example:
```bash
curl -X POST http://localhost:999/messages \
-H "Content-Type: application/json" \
-d '{"message": "Hello World"}'
```## 📦 Message Caching
Messages are cached daily, using a date-based key format. Cached messages can be fetched via `GET /messages` or added via `POST /messages`.
## 🔐 Security
The API is secured with:
- **CORS**: Allows cross-origin requests.
- **Secure Headers**: Provides protection against common web vulnerabilities.## 🧑💻 Development
- To lint or format your code, use Deno's built-in tools:
```bash
deno lint
deno fmt
```## 🤝 Contributing
Contributions are welcome! Please submit issues or pull requests.