Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itsyoboieltr/elysia-group-router
Group router for Elysia.
https://github.com/itsyoboieltr/elysia-group-router
Last synced: 3 months ago
JSON representation
Group router for Elysia.
- Host: GitHub
- URL: https://github.com/itsyoboieltr/elysia-group-router
- Owner: itsyoboieltr
- Created: 2023-07-27T22:50:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-28T23:19:16.000Z (over 1 year ago)
- Last Synced: 2024-07-29T12:36:52.759Z (4 months ago)
- Language: TypeScript
- Size: 7.81 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-elysia - Group Router - File system and folder-based router for groups. (Plugins)
README
# elysia-group-router
Group router for [Elysia](https://elysiajs.com/), to help you separate and manage your groups.
## Install
```bash
bun add elysia-group-router
```## Usage
### 1. Register the plugin
```ts
import { Elysia } from 'elysia';
import groupRouter from 'elysia-group-router';new Elysia().use((app) => groupRouter(app, 'groups')).listen(3000);
```### 2. Create your first group in the `groups` directory
```ts
// file: groups/hello/index.ts
// url: http://localhost:3000/helloimport type { Elysia } from 'elysia';
export default function helloGroup(app: Elysia, prefix: string) {
return app.group(prefix, (app) => app.get('', () => 'hello'));
}
```## License
MIT