LawfulGood / infuse

A magical framework
MIT License
4 stars 0 forks source link

Filesystem Routing #5

Open clone1018 opened 7 years ago

clone1018 commented 7 years ago

This seems like the hardest chunk of code we need to make it to "development".

Aspen does it like: https://github.com/AspenWeb/aspen.py/blob/5d67ba6bd23d7fb1dd2756a9e751b7e963438c25/aspen/request_processor/dispatcher.py#L120

clone1018 commented 7 years ago

It wont be so bad if it starts off small, the hard part will be fitting it into nice eloquent Elixir code

clone1018 commented 7 years ago

Aspen lazy-loads routes, so when a request comes in it's parsed.

I'm wondering: since we use Plug, can we determine the legal routes to a simplate and register them on app init?

clone1018 commented 7 years ago

Coming back to it I love the idea of compiled routes, that'll maximize our speed.

clone1018 commented 7 years ago

Plug.Router is for compile-time definition of routes (as it relies on defining a patter matching functions). I don't think there's a built-in module for runtime routing.

clone1018 commented 7 years ago

Very beginning: https://github.com/clone1018/infuse/pull/13

clone1018 commented 7 years ago

Alright we now have a much better system using https://github.com/LawfulGood/infuse/tree/master/lib/http