What is the difference between route and controller in noderexpress?

  node.js, question

What is the main difference?

Express inside has no controller. Controller is a collection of codes that deal with business logic in the process of implementing MVC development pattern.

When using Express to develop, router does routing and deals with paths specially. Correlate the request of a certain path with the controller of processing logic. For example:

var router = express.Router();
 .post(authController.isAuthenticated, petController.postPets)
 .get(authController.isAuthenticated, api.http(petApi.browse));
 .get(authController.isAuthenticated, petController.getPet)
 .put(authController.isAuthenticated, petController.updatePet)
 .delete(authController.isAuthenticated, petController.deletePet);

The above code is API, so there is no specific concept of View. Or View is the front-end APP that consumes these apis.