Last active
February 8, 2025 20:30
-
-
Save ethanniser/998522056c046d5911c0e05f69eb94a5 to your computer and use it in GitHub Desktop.
Seperate Files in Elysia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const ctx = new Elysia({ | |
| name: "@app/ctx", | |
| }) | |
| .use(plugin()) | |
| .decorate("db", db) | |
| .decorate("config", config) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ctx } from "./base" | |
| export const todos = new Elysia() | |
| .use(ctx) | |
| .get("/todos", async () => { | |
| const data = await db.select().from(todos); | |
| return data; | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { todos } from "./handlers" | |
| const app = new Elysia() | |
| .use(todos) | |
| // ... | |
| .listen(3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i am almost positive they do get deduplicated so yes
but i would ask in the elysia discord bc its been so long