课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Using an API endpoint from the browser
课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
Using an API endpoint from the browser
- [Instructor] We created an API endpoint with Mock Data for the list of contests. Let's now figure out how to use it from the client. The first thing we need is a configuration variable. The reason we need a new configuration variable here is because I will not assume that the API server is the same as the host server. So introducing another server URL environment variable here is a good idea so that we get the option of running the API server on a different node. Let me name this one API server URL. And it's the same for our simplified project but we can add slash API here to simplify our calls. And then in the app component we need to load this data somewhere through an HTTP call. We can do it in the app component or we can do it in the main file where we tell React do to render an app component. Let me do it here. So we need an HTTP client A client capable of doing an HTTP request to a server and giving us back data.…
内容
-
-
-
-
-
Creating a mock API endpoint5 分钟 52 秒
-
(已锁定)
Using an API endpoint from the browser9 分钟 2 秒
-
(已锁定)
Rendering a list of items8 分钟 47 秒
-
(已锁定)
React’s key for items in a list4 分钟 29 秒
-
(已锁定)
Fetching data while React is rendering8 分钟 5 秒
-
(已锁定)
Server-side rendering of the root path7 分钟 41 秒
-
(已锁定)
Sharing data between server and client5 分钟 1 秒
-
(已锁定)
Fetching data from MongoDB6 分钟 17 秒
-
-
-