hiposfer / hive

Your go-to routing app for public transport
GNU Lesser General Public License v3.0
10 stars 0 forks source link

consider creating a jsonApi library for http operations with core.async #102

Closed carocad closed 6 years ago

carocad commented 6 years ago

This is heavily inspired by:

Json api provides a way to shape both the request and the response from http requests that takes away the guess work when creating and consuming resources.

However, while doing http request there are several repetitive parts that, although necessary, just get in the way.

Kitsu provides a very good design for creating queries and headers.

A possible way to use it in Clojurescript would be

(def kamal (api/service {:url "http://kamal.hiposfer.com"
                         :headers {:agent': "myapp" :auth "Bearer 1234567890"}})

(api/get kamal :directions/v5 {:coordinates [[1 2] [3 4]]}
                              {:cache-control "no-cache"})

A couple of remarks from the previous snippet

related to: https://github.com/hiposfer/kamal/issues/164

carocad commented 6 years ago

nice idea ... but no. This would be re-inventing the wheel

In the case that we want that we should just use a library out there that can handle json api