Is that possible to have multiple routes in the same route class?

Something like:
@ApplyOptions<RouteOptions>({ route: 'users' })
export class UsersRoute extends Route {
// GET in /users
public async [methods.GET](request: ApiRequest, response: ApiResponse) {
// ...
return response.json(responseData);
}

// DELETE in /users/:userId
public async [methods.DELETE](request: ApiRequest, response: ApiResponse) {
//
return response.ok('...');
}
}
@ApplyOptions<RouteOptions>({ route: 'users' })
export class UsersRoute extends Route {
// GET in /users
public async [methods.GET](request: ApiRequest, response: ApiResponse) {
// ...
return response.json(responseData);
}

// DELETE in /users/:userId
public async [methods.DELETE](request: ApiRequest, response: ApiResponse) {
//
return response.ok('...');
}
}
Solution:
it is not
Jump to solution
1 Reply
Solution
Favna
Favna11mo ago
it is not
Want results from more Discord servers?
Add your server