From 1f0b049cb73dbe9eed8ddf1188d25893dd7f1ca2 Mon Sep 17 00:00:00 2001 From: Kaushik Date: Sat, 12 Nov 2022 16:37:02 +0530 Subject: [PATCH] Folder structure, READMEs --- .sequelizerc | 2 +- boilerplates/README.md | 1 + config/README.md | 1 + config/{config.js => sequelize.js} | 0 controllers/README.md | 1 + middleware/README.md | 1 + migrations/README.md | 1 + models/README.md | 1 + models/index.js | 2 +- routes/README.md | 1 + seeders/README.md | 1 + utils/README.md | 1 + validators/README.md | 1 + 13 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 boilerplates/README.md create mode 100644 config/README.md rename config/{config.js => sequelize.js} (100%) create mode 100644 controllers/README.md create mode 100644 middleware/README.md create mode 100644 migrations/README.md create mode 100644 models/README.md create mode 100644 routes/README.md create mode 100644 seeders/README.md create mode 100644 utils/README.md create mode 100644 validators/README.md diff --git a/.sequelizerc b/.sequelizerc index 3794b85..df63de1 100644 --- a/.sequelizerc +++ b/.sequelizerc @@ -2,5 +2,5 @@ require("dotenv-flow").config(); const path = require("path"); module.exports = { - "config": path.resolve("config", "config.js") + "config": path.resolve("config", "sequelize.js") }; \ No newline at end of file diff --git a/boilerplates/README.md b/boilerplates/README.md new file mode 100644 index 0000000..253f1b5 --- /dev/null +++ b/boilerplates/README.md @@ -0,0 +1 @@ +## Boilerplates - reusable code templates diff --git a/config/README.md b/config/README.md new file mode 100644 index 0000000..5226b6f --- /dev/null +++ b/config/README.md @@ -0,0 +1 @@ +## Configuration files and data diff --git a/config/config.js b/config/sequelize.js similarity index 100% rename from config/config.js rename to config/sequelize.js diff --git a/controllers/README.md b/controllers/README.md new file mode 100644 index 0000000..13c38a2 --- /dev/null +++ b/controllers/README.md @@ -0,0 +1 @@ +## Controllers - business logic functions, end of the API route diff --git a/middleware/README.md b/middleware/README.md new file mode 100644 index 0000000..0105bf2 --- /dev/null +++ b/middleware/README.md @@ -0,0 +1 @@ +## Middleware - functionalities that must be in the middle of the API route control flow diff --git a/migrations/README.md b/migrations/README.md new file mode 100644 index 0000000..377a75c --- /dev/null +++ b/migrations/README.md @@ -0,0 +1 @@ +## Database (mainly Sequelize's) migrations diff --git a/models/README.md b/models/README.md new file mode 100644 index 0000000..1fb5dab --- /dev/null +++ b/models/README.md @@ -0,0 +1 @@ +## Database ORM (mainly Sequelize's) models diff --git a/models/index.js b/models/index.js index e1e4b5e..047dbf0 100644 --- a/models/index.js +++ b/models/index.js @@ -5,7 +5,7 @@ const Sequelize = require("sequelize"); const basename = path.basename(__filename); const env = process.env.NODE_ENV || "development"; -const config = require(__dirname + "/../config/config.js")[env]; +const config = require(__dirname + "/../config/sequelize.js")[env]; const db = {}; // Create new Sequelize instance diff --git a/routes/README.md b/routes/README.md new file mode 100644 index 0000000..a549c83 --- /dev/null +++ b/routes/README.md @@ -0,0 +1 @@ +## Routes - define control flow of the API route diff --git a/seeders/README.md b/seeders/README.md new file mode 100644 index 0000000..568f274 --- /dev/null +++ b/seeders/README.md @@ -0,0 +1 @@ +## Database (mainly Sequelize's) seeders - initial data feed, for dummy data and testing diff --git a/utils/README.md b/utils/README.md new file mode 100644 index 0000000..5747518 --- /dev/null +++ b/utils/README.md @@ -0,0 +1 @@ +## General, reusable functionalities unrelated to API diff --git a/validators/README.md b/validators/README.md new file mode 100644 index 0000000..3fbd7c6 --- /dev/null +++ b/validators/README.md @@ -0,0 +1 @@ +## Validators - middleware functions for request object validation