Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

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/hello

import type { Elysia } from 'elysia';

export default function helloGroup(app: Elysia, prefix: string) {
return app.group(prefix, (app) => app.get('', () => 'hello'));
}
```

## License

MIT