elysia-autoload icon indicating copy to clipboard operation
elysia-autoload copied to clipboard

Add support for "new Elysia" routes

Open deadlinecode opened this issue 6 months ago • 4 comments

Currently routes only work when defining them like this

import type { ElysiaApp } from "app";

export default (app: ElysiaApp) => app.get("/", { hello: "world" });

Normally i often define my routes like this

import Elysia from "elysia";

export default new Elysia().get("/", { hello: "world" });

Which doesn't seem to work with autoload but it should. Also this should work which does not

import Elysia from "elysia";

export default () => new Elysia().get("/", { hello: "world" });

The first one throws an error and the second one doesn't but the second one also doesn't handle anything i still get an 404 on "/"

deadlinecode avatar Aug 16 '24 17:08 deadlinecode