Introduction

OVER is a TypeScript and Node.js plug & play comments micro-service that allows you create a comments, get, filter, rating, and paginate the incoming data from the API's endpoint .. and also nested replies using one to many self-relationship.
Built using pure express.js application with MySQL without using an ORM.

Project Structure

OVER
|--dev // Dev directory.
| |--types // includes TypeScript's local types.
| | |--root.d.ts
|--node_modules // Node modules directory.
|--src // Source directory.
| |--app // App directory.
| | |--Controllers // Includes app's controllers (e.g. HomeController.ts).
| | |--Http // Http directory which includes (middlewares, kernel. router..)
| | | |--Middleware // Place to create and register a middlewares.
| | | |--Kernel.ts // Server's kernel class.
| | | |--Router.ts // An easy router class to work with routes (inspired by Laravel).
| | |--Models // Includes app's models (e.g. Comment.ts).
| | |--Validations // Request's validation.
| | |--helpers.ts // Includes helpers methods to be used elsewhere in the application.
| |--config // Config directory
| | |--app.ts // Application's configurations.
| | |--database.ts // Database's configurations.
| |--database // Database directory
| | |--connection.ts // Database Connection.
| | |--migrations.ts // Database mifrations.
| |--routes // Routes directory.
| | |--api.ts // api routes.
| |--server.ts // Server class.
|--.env // environment variables file.
|--.gitignore // gitignore file.
|--nodemon.json // Nodemon configurations.
|--package.json
|--package-lock.json
|--tsconfig.json // Typescript config file.
_________________________
13 directories, 21 files

Database

Columns ofcomments table
name
type
null
default
Primary Key
id
VARCHAR(255)
no
none
PK
commentable_key
VARCHAR(255)
no
none
commentable_id
VARCHAR(255)
no
none
name
VARCHAR(255)
no
none
email
VARCHAR(255)
no
none
body
VARCHAR(255)
no
none
rating
int(11)
no
0
reply_id
VARCHAR(255)
yes
NULL
created_at
TIMESTAMP
no
CURRENT_TIMESTAMP
Last modified 1yr ago