简体   繁体   中英

Making calls to API Servers from a frontend web server

I'm a little confused about frontend servers making calls to API Servers.

When I access a frontend site, the browser connects to the frontend server and the html files are downloaded and copied into my browser. So when i make an API call, is the call being made from frontend web server or from the browser?

There is no such thing as a frontend web server. When you connect to a website on the web, your computer connects to a web server, which then sends the requested files back to your browser.

When you make an API call, the same thing is essentially happening. You are either requesting or sending data to a server. The question as to where the call originates from depends on what you are using to call said server. If it's a web browser, then yeah it's the browser who's responsible for sending the request

I think you might be referring to the front-end framework like Vue, Angular, etc. If you use Vue for example, you can make API call from there (the front-end) using a specified package like axios.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM