Giter Club home page Giter Club logo

Comments (16)

wobsoriano avatar wobsoriano commented on July 28, 2024 4

Here's one - https://github.com/wobsoriano/elysia-autoroutes

from elysia.

itsyoboieltr avatar itsyoboieltr commented on July 28, 2024 1

I also made an implementation of a file system routing plugin, based on groups, called the group router.

from elysia.

itsyoboieltr avatar itsyoboieltr commented on July 28, 2024 1

@m1212e what other meta framework do, like Nuxt, is to generate types for each route at dev time

@wobsoriano Actually, I tried to do something similar here (with not much success): #79

from elysia.

itsyoboieltr avatar itsyoboieltr commented on July 28, 2024

+1, I would be really interested in this, I was just about to raise a proposal for this exactly.

from elysia.

fecony avatar fecony commented on July 28, 2024

But Elysia doesn't really have frontend part so file based routing for api doesn't make sense..?

from elysia.

itsyoboieltr avatar itsyoboieltr commented on July 28, 2024

But Elysia doesn't really have frontend part so file based routing for api doesn't make sense..?

This has nothing to do with frontend or not.

For reference, check Next.js route handler implementation for a file-system based api.

from elysia.

fecony avatar fecony commented on July 28, 2024

But Elysia doesn't really have frontend part so file based routing for api doesn't make sense..?

This has nothing to do with frontend or not.

For reference, check Next.js route handler implementation for a file-system based api.

I didn't play with file based api, from one side looks like overhead of splitting everything
on the other looks like a good solution to extract those and make smaller

from elysia.

ethanniser avatar ethanniser commented on July 28, 2024

I don't think it would be too hard to make your own simple implementation
See the "However, it isn't too difficult to make a file-based router. Here's a file-based example code with builder:" part of the Waku docs

from elysia.

m1212e avatar m1212e commented on July 28, 2024

There are a few options, you could calculate the routes based on the current file path and just pass a helper function to spit out the correct relative path based on the file location, you could also utilize the bun.js macros/build plugins to set the correct path at build time. But what I could not get to work properly was the eden type safety. Since it works without code generation and TS does not support build time macros, I don't really seee a way to pull this off. Maybe one of the elysia devs knows how to implement something like this.

from elysia.

ethanniser avatar ethanniser commented on July 28, 2024

was just randomly reading the bun docs today and saw it has a native FileSystemRouter API that may be of use here

https://bun.sh/docs/api/file-system-router

from elysia.

wobsoriano avatar wobsoriano commented on July 28, 2024

was just randomly reading the bun docs today and saw it has a native FileSystemRouter API that may be of use here

https://bun.sh/docs/api/file-system-router

elysia-autoroutes uses it!

from elysia.

m1212e avatar m1212e commented on July 28, 2024

@wobsoriano Did you manage to get eden types to work with it?

from elysia.

wobsoriano avatar wobsoriano commented on July 28, 2024

No. That's the biggest challenge @m1212e - how do we combine types from the main ElysiaApp instance with the route files?

from elysia.

m1212e avatar m1212e commented on July 28, 2024

I don't see a way to do this without running some kind of process at development time.

from elysia.

wobsoriano avatar wobsoriano commented on July 28, 2024

@m1212e what other meta framework do, like Nuxt, is to generate types for each route at dev time

from elysia.

SaltyAom avatar SaltyAom commented on July 28, 2024

Closing as we have several plugins like Elysia Autoroute, Group Router and several other.

Elysia is not going to focus on File Based Routing at the moment.
All the discussion will be moving to #79 or feels free to open a new issue for dedicated topic.

from elysia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.