You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-30Lines changed: 21 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,61 +10,52 @@ Proof of concept at making http requests easier to work with in JS / Node. This
10
10
npm install legible --save
11
11
```
12
12
13
-
A request library using template literals. Making requests has never been so straight forward! Make it easy for users to adopt your api, document it using this library, and everyone will understand making requests.
13
+
A request library using template literals. Making requests has never been so straight forward! Make it easy for users to adopt your api, document it using this library, and everyone will understand making requests.
14
14
15
15
###Example
16
16
17
17
```js
18
18
importrequestfrom'legible'
19
19
20
20
asyncfunctionTestRequest() {
21
-
let body = {
22
-
email:'test@test.com',
23
-
password:'secret'
21
+
let body = {
22
+
email:'test@test.com',
23
+
password:'secret'
24
24
}
25
-
25
+
26
26
let response =await request`
27
27
url: https://api.myapp.com/register
28
28
method: POST
29
29
body: ${body}
30
-
headers: ${{
31
-
Authorization:'Bearer: token'
30
+
headers: ${{
31
+
Authorization:'Bearer: token'
32
32
}}
33
33
`
34
34
}
35
35
```
36
36
37
37
##Why Legible?
38
38
39
-
**Coming Soon** The following isn't implemented yet.
39
+
**New in 0.2.0!**
40
40
41
41
42
42
Using template strings, we can pull out variables easily and keep requests as `legible` as possible. Imagine splitting out your code like this using api libraries that include requests like so:
0 commit comments