Function Routes
Warning Breaking changes ahead, only if you're using the css
, js
or app
functions
I try not to make too many breaking changes, but it's still early days
and hopefully no one was using the js/css bundler stuff.
Also I don't plan on introducing breaking changes EVER after 1.0
In fact my strategy is if I want to break things too much, I will release a whole new repo named joy2.
Let's hope it never comes to that.
Change script/link functions
Anyway if you were using those functions change this:
(css "/style1.css" "/style2.css")
to this
(link {:href ["/style1.css" "/style2.css"]})
and the js is similar:
(js "/js1.js" "/js2.js")
to:
(script {:src ["/js1.js" "/js2.js"]})
with the added benefit now of adding other attributes, like :defer
Function routes
Again, this doesn't happen often (or at all) but sometimes a new feature
is just too good to pass up.
If you are using the app function, it has changed to handlers, so this:
(app (handler routes1) (handler routes2))
is now this:
(handlers (handler routes1) (handler routes2))
What do you get from this breaking change?
Let me show you something really cool:
(use joy)
(defn / [request]
(text/html
[:h1 "You found joy!"]))
(def app (app))
(server app 9001) # go ahead and visit http://localhost:9001 I dare ya
That is all it takes now to get a joy app up and running!
- fcb95e6 - Bump version
- a4d42cd - Handle not found routes better. Fix query string routes
- a62b780 - Stop manually symlinking to /usr/local/bin
- 7ef7935 - Use dotenv, remove env.janet
- 636318d - Depend on dotenv
- 4cf4697 - Rename app to handlers. Use app as default middleware stack function.
- fcc34ef - Change script/link functions. Delete css/js functions.
- 1dc5576 - Handle trailing slashes in routes
- 8c830c0 - Update link to janet-html
- abf7bd8 - Add dotenv/load to new project template
- cee8f4d - Smaller routing code, add wildcard routes
- a0b9fed - Check for layout-fn before trying to call it
- 6dd1c5b - Decode json body as keywords
- 06f95a1 - Fix csrf-field comments
- 9c1d3e8 - Comment csrf functions and cli/migrations
- 80ab541 - Update README.md