![]() ![]() First, we set up some defaults: // main.jsĪ = '' // the prefix of the URLĪ = 'application/json' // default header for all get requestĪ = 'application/json' // default header for all POST request Here’s an example where our API has a base, but it also has multiple different endpoints. For each request, we don’t have to repeat the baseURL of our API or repeat important headers that we might need on every request. The rest of them are less frequently needed as they have smart defaults, but it’s nice to know there are there in case you need to fix up requests. Most of time, you’ll only be using baseURL, header, and maybe timeout.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |