API DIRECTORY STRUCTURE - itsvermaji/speedlabs-ekart-module GitHub Wiki
📦server ┣ 📂src ┃ ┣ 📂app ┃ ┃ ┣ 📂config ┃ ┃ ┣ 📂helpers ┃ ┃ ┣ 📂http ┃ ┃ ┃ ┣ 📂controllers ┃ ┃ ┃ ┗ 📂middlewares ┃ ┣ 📂public ┃ ┣ 📂routes ┃ ┗ 📂validations ┃ ┗ 📜server.js
The config folder contains all the configurations related to database and payment functionality.
All the functions which contains mathematical computation are present inside this directory.
The controllers folder contains all the logic of the server. Functions like product creation, student registration are inside this directory. Middlewares folder contains the middlewares which need to be executed before executing the core logic present inside the controllers directory eg user authentication, institute authentication.
Static files like pdf or videos are present inside this directory.
This directory contains all the routes of this API. The file
index.js
is the file from where all the routes are divided further.
It contains basic validation functions like validating coupons etc.
This is the heart of the server. All the server configurations, routes, static directories are called defined in this file.
router.get('/endpoint', [middlewares like institute/user auth present in middlewares dir], callback_name present in controllers dir);