directus / v8-archive

Directus Database API — Wraps Custom SQL Databases with a REST/GraphQL API
https://docs.directus.io/api/reference.html
505 stars 204 forks source link

Replace axios with <don't know yet> #2336

Open janbiasi opened 5 years ago

janbiasi commented 5 years ago

🚀 feature request

Description

Axios is a quite heavy library for simple promise based HTTP calls (gzipped about ~4.3kB), so it would be great to replace it with a better alternative or other approach on API calls.

Describe the solution you'd like

1) Make a monorepository out of the SDK while providing

Pro: you get a plug-and-play system which just imports/loads what you need based on your environment. Thus you would also slim-down the whole SDK and split the platform based operations out of the core. Preparation therefor has already been done in the typescript branch with splitting the API class from the core to a separate file (pluggable). Con: introduces more complexity with using Lerna, things get heavier to handle.

2) Use an isomorphic tool like fetch

Pro: also a benefit for modern browsers, quite simple to implement (ETA 2h). Con: can lead to weird cases and testing gets complicated.

3) ... to be defined

rijkvanzanten commented 5 years ago

For the monorepo way; lets keep in mind that I'd still like to offer a local version (next to remote). Remote being the sdk that connects to an existing API, local being connecting straight to a database

janbiasi commented 5 years ago

At the moment I'd go for version 2 just because the modern browsers would benefit a lot, and v1 adds just more complexity. Eventually we'll also find some other possible fixes for this one :D