joy icon indicating copy to clipboard operation
joy copied to clipboard

Improvement suggestion for the default template

Open oz123 opened this issue 3 years ago • 3 comments

First, let me say thanks! I just started with joy and it is a joy! I saw you also created a nice testing framework. How about adding a simple test case to the default template to encourage people to write tests and also demonstrate the framework?

oz123 avatar Oct 08 '20 18:10 oz123

Yeah, what's funny is I had a sample test in there that just called app and checked for a success response but I took it out.

Not sure why now that I think about it.

It's time to put it back in though, I agree

swlkr avatar Oct 08 '20 22:10 swlkr

A few more suggestions:

  • Add a JSON API end point to the routes (in main.janet):
(defn api [request]
  (application/json {:you-found "joy"})
 )
 ...
(def routes (routes [:get "/" home] [:get "/api" api]))

  • Add a test case which uses https://github.com/joy-framework/http to check that the API works. ~~I can add the first suggestion. For the second one I need some help ...~~

@swlkr I figured out how to use http (it's pretty awesome that this is simply syntactic sugar on top of curl). Would like me to send a PR with my suggestions?

oz123 avatar Oct 09 '20 08:10 oz123

Yeah! Open up a PR and we can get it merged

swlkr avatar Oct 14 '20 14:10 swlkr