code to explanationTue, 15 Nov 2022

const express = require('express'); const mainController = require('./controllers/mainController'); const router = express.Router(); // affichage des contacts dans mon agenda router.get("/",mainController.getHome); router.get("/contact/:id",mainController.getContact); // réception du formulaire"/",mainController.addContact); module.exports = router;

This code allows to use the router of express which is a middleware that helps us to create routes for our app, it allows us to use the url to trigger a certain function (getHome for example), after that we have the function that allows the app to return the home page.

Questions about programming?Chat with your personal AI assistant