Difference between route and endpoint?

Asked by At

Question:

I have a probably rather simple question, but I'm unable to find an answer with nice explanations:

What is the difference (if any) between a route and an endpoint in the context of a RESTful API developed within a Node.js / Express application (but these concepts may be broader?!...)?
(Does it relate to URLs in some way?)


Example:

For example, in this article: https://medium.com/@purposenigeria/build-a-restful-api-with-node-js-and-express-js-d7e59c7a3dfb we can read:

We imported express which we installed at the beginning of the course, app.get makes a get request to the server with the route/endpoint provided as the first parameter, the endpoint is meant to return all the todos in the database.

These concepts are used interchangeably, which makes me confused.
(please note that I'm a 100% beginner with REST API, nodejs and express but I try to do my best to learn).

Edit:
The two first answers make me even more confused as they are perfectly antagonistic.

2 Answers

2
faiz Khan On

Endpoints are basically use to perform specific task and return data and endpoints are kind of part of a route.

For example https://stackoverflow.com/questions/56075017/difference-between-route-and-endpoint is route and this https://stackoverflow.com/questions/56040846/how-to-use-the-classweight-option-of-model-fit-in-tensorflow-js is also a route but here both of them are returning different data not he same so, we can say that the last two parameter here is kind of end point means the id and question string.

endpoints:

 /56075017/difference-between-route-and-endpoint
 /56040846/how-to-use-the-classweight-option-of-model-fit-in-tensorflow-js

route:

https://stackoverflow.com/questions/56075017/difference-between-route-and-endpoint
https://stackoverflow.com/questions/56040846/how-to-use-the-classweight-option-of-model-fit-in-tensorflow-js
0
pavan anand chinthalapudi On

Endpoint: Endpoint is a URL which is used to perform a specific task or functionality.(eg:https://localhost:3000/route)

Route: It is a part of URL endpoint that routes the pages to different components.(eg: https://localhost:3000/thisIsRoute)