gaurishhs/elysia-decorators

Example contains a missing `path` for the `Get()` decorator - causes a type error

Closed this issue · 1 comments

Example should be updated to add a path string as an argument to the Get() decorator to avoid a type error:

import { Controller, Get, decorators } from "elysia-decorators";
import { Elysia } from "elysia";

// /users prefix
@Controller("/users/")
class UsersController {
  @Get("")
  index() {
    return "Hello World";
  }
}

const app = new Elysia();

app.use(
  decorators({
    controllers: [UsersController],
  })
);

app.listen(3000);

Additionally, the user will need to make sure to set "experimentalDecorators": true, in their tsconfig.json compilerOptions object to avoid a type error on the Controller() decorator argument.

Fixed