1//Frontend
2const getUsers = async () => {
3 const response = await fetch('https://yourapi.com/api/users');
4 const data = await response.json();
5 return data; //Our users
6}
7
8//Backend
9 //./routes/
10 //If we recieve a call to /api/users we call to usersController
11app.get('/api/users', usersController)
12
13 // ./controllers
14const usersControllers = () => {
15 const users = modelUser.get();//Ey model give me users from database
16 //Do logic with our users and return it
17}
18
19 // ./models
20const modelUser = {
21 get: () => databaseCall('SELECT * FROM users'); //Ey database give me users
22}
23
24