API DIRECTORY STRUCTURE - itsvermaji/speedlabs-ekart-module GitHub Wiki

server

Folder Structure

📦server
┣ 📂src
┃ ┣ 📂app
┃ ┃ ┣ 📂config
┃ ┃ ┣ 📂helpers
┃ ┃ ┣ 📂http
┃ ┃ ┃ ┣ 📂controllers
┃ ┃ ┃ ┗ 📂middlewares
┃ ┣ 📂public
┃ ┣ 📂routes
┃ ┗ 📂validations
┃
┗ 📜server.js

src

app

config

The config folder contains all the configurations related to database and payment functionality.

helpers

All the functions which contains mathematical computation are present inside this directory.

http

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.

public

Static files like pdf or videos are present inside this directory.

routes

This directory contains all the routes of this API. The file index.js is the file from where all the routes are divided further.

validations

It contains basic validation functions like validating coupons etc.

server.js

This is the heart of the server. All the server configurations, routes, static directories are called defined in this file.

Syntax

router.get('/endpoint', [middlewares like institute/user auth present in middlewares dir], callback_name present in controllers dir);

⚠️ **GitHub.com Fallback** ⚠️