Rosencrantz – A Web DSL for Nim
github.com
Rosencrantz – A Web DSL for Nim
1–10 of 31 posts
Re: Rosencrantz – A Web DSL for Nim
#2Re: Rosencrantz – A Web DSL for Nim
#3Re: Rosencrantz – A Web DSL for Nim
#4Nim is one of those underpublicized language. It's really good, I will leave it at that. I've used it a few times and it takes maybe 10 minutes to get back into it. It's perfect for making tools.
Re: Rosencrantz – A Web DSL for Nim
#5It looks like a great fit for Nim though.
Re: Rosencrantz – A Web DSL for Nim
#6Nim is one of those underpublicized language. It's really good, I will leave it at that. I've used it a few times and it takes maybe 10 minutes to get back into it. It's perfect for making tools.
Re: Rosencrantz – A Web DSL for Nim
#7Re: Rosencrantz – A Web DSL for Nim
#8Re: Rosencrantz – A Web DSL for Nim
#9Sad to see all these [] and () in Nim, which has such a beautiful syntax to start with.
Re: Rosencrantz – A Web DSL for Nim
#10Why not Jester[1]? Jester has a better API, IMO. [1]: https://github.com/dom96/jester
Jester, like many other frameworks, hardcodes exactly what to do with a Request - say parsing the headers, parsing the form if the content type suggests so, always return a date, and so on.
This is not bad per se, but I prefer to have something I can compose. Say, I have a working route `r`. If I want to add CORS support, for instance, I can just make a handler `h` that adds CORS headers and then use the route `h -> r`.
This is more flexible and leaves fine grained control over which headers to require, or return, how to do content negotiation, and so on. You can separate your routes for `POST` from those for `GET` in different modules and then combine them, or maybe separate your authentication routes from the business logic ones. You can easily create handlers that work as middleware, and so on.
In short, the thing I like about this approach is that handlers become first class objects that you can manipulate and create freely