REST
Last updated
Was this helpful?
Last updated
Was this helpful?
Last part, let's make Express answer with a list of people.
We now have two routes in our express app. /
leads to "ok", and /contacts/list
gives us a list of contacts.
Run the app, and try it; navigate to , and verify you see a list of people
Great! Moving on to linkage with the front-end now. We're almost done with our setup
Let's go back to our front end. We need to be able to access this data.
In a first instance, let's keep it simple. We're simply going to query the back-end, and log the answer
Move into front/src
, open index.js
, and write in it, anywhere:
Let's use that in React now. Remove the lines above, we don't need them anymore
run the root npm start
, to start the back and front. Go to , and check the console. You should see the contacts in your log. Ok great!