|
| 1 | + |
| 2 | +## Intro |
| 3 | + |
| 4 | +From the video [Vue Tutorial #5 - AJAX data and Lifecycle Methods](https://youtu.be/inJDWcHmsss) you could notice there is REST service at `http://rest.learncode.academy/api/vue-5/friends` |
| 5 | + |
| 6 | +Infact "vue-5" is only user name... |
| 7 | + |
| 8 | +The common link is `http://rest.learncode.academy/api/`**{username}**`/friends` |
| 9 | + |
1 | 10 | ## Check if data exists
|
2 | 11 |
|
3 | 12 | It's possible that data has been deleted before you run an example and see this tutorial.
|
4 | 13 | Please check the data:
|
5 | 14 |
|
6 |
| -Visit [http://rest.learncode.academy/api/vue-5/friends](http://rest.learncode.academy/api/vue-5/friends) to see it. |
| 15 | +Visit one of the link below to see the data: |
| 16 | + |
| 17 | +[http://rest.learncode.academy/api/vue-5/friends](http://rest.learncode.academy/api/vue-5/friends); |
| 18 | + |
| 19 | +[http://rest.learncode.academy/api/john/friends](http://rest.learncode.academy/api/john/friends); |
| 20 | + |
| 21 | +[http://rest.learncode.academy/api/bobby/friends](http://rest.learncode.academy/api/bobby/friends); |
| 22 | + |
| 23 | +[http://rest.learncode.academy/api/someuser/friends](http://rest.learncode.academy/api/someuser/friends); |
| 24 | + |
| 25 | +etc. |
| 26 | + |
7 | 27 |
|
8 | 28 | If data isn't there, move to the next chapter and create it!
|
9 | 29 |
|
10 | 30 | ## Add data via curl
|
11 | 31 |
|
12 | 32 | Open console and run commands:
|
13 | 33 |
|
14 |
| -`curl -H "Content-Type:application/json" -X POST -d '{"name":"Will"}' http://rest.learncode.academy/api/vue-5/friends` |
| 34 | +`curl -H "Content-Type:application/json" -X POST -d '{"name":"Will"}' http://rest.learncode.academy/api/someuser/friends` |
| 35 | + |
| 36 | +`curl -H "Content-Type:application/json" -X POST -d '{"name":"John"}' http://rest.learncode.academy/api/someuser/friends` |
15 | 37 |
|
16 |
| -`curl -H "Content-Type:application/json" -X POST -d '{"name":"John"}' http://rest.learncode.academy/api/vue-5/friends` |
| 38 | +`curl -H "Content-Type:application/json" -X POST -d '{"name":"Bill"}' http://rest.learncode.academy/api/someuser/friends` |
17 | 39 |
|
18 |
| -`curl -H "Content-Type:application/json" -X POST -d '{"name":"Bill"}' http://rest.learncode.academy/api/vue-5/friends` |
| 40 | +Then visit [http://rest.learncode.academy/api/someuser/friends](http://rest.learncode.academy/api/someuser/friends) and ensure the data has been added. |
19 | 41 |
|
20 |
| -Then visit [http://rest.learncode.academy/api/vue-5/friends](http://rest.learncode.academy/api/vue-5/friends) and ensure the data has been added. |
| 42 | +NOTE! Use `http://rest.learncode.academy/api/someuser/friends` in you main.js |
0 commit comments