Closed ghost closed 4 years ago
I should probably mention in the readme that routes map to database tables...
I could probably make a version of the route generator that doesn't rely on a database table too
Currently you need to write out handlers without database tables by hand:
(route :get "/about" :about)
(defn about [req]
[:h1 "/about"])
Oh I think I get the confusion now, this is my fault for confusing the two terms.
I should do two things here:
joy create route x
generator to just generate new files with single route functions in them like above route
generator to joy create controller x
and then get rid of any docs that talk about joy having "no controllers" 😅
Yeah, I guess that's better! Keep it up, this is getting pretty good and usable
So now this:
joy create route about
Will create (or update) a file named routes/pages.janet
and put this in there:
(route :get "/about" :pages/about)
(defn pages/about [req]
[:h1 "/about"])
oh and it also updates the main.janet
file with an import statement:
(use joy)
(use ./routes/pages)
Everytime I run the
create route
command I get something like:Running the latest Janet version.