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

1
OVER
2
|--dev // Dev directory.
3
| |--types // includes TypeScript's local types.
4
| | |--root.d.ts
5
|--node_modules // Node modules directory.
6
|--src // Source directory.
7
| |--app // App directory.
8
| | |--Controllers // Includes app's controllers (e.g. HomeController.ts).
9
| | |--Http // Http directory which includes (middlewares, kernel. router..)
10
| | | |--Middleware // Place to create and register a middlewares.
11
| | | |--Kernel.ts // Server's kernel class.
12
| | | |--Router.ts // An easy router class to work with routes (inspired by Laravel).
13
| | |--Models // Includes app's models (e.g. Comment.ts).
14
| | |--Validations // Request's validation.
15
| | |--helpers.ts // Includes helpers methods to be used elsewhere in the application.
16
| |--config // Config directory
17
| | |--app.ts // Application's configurations.
18
| | |--database.ts // Database's configurations.
19
| |--database // Database directory
20
| | |--connection.ts // Database Connection.
21
| | |--migrations.ts // Database mifrations.
22
| |--routes // Routes directory.
23
| | |--api.ts // api routes.
24
| |--server.ts // Server class.
25
|--.env // environment variables file.
26
|--.gitignore // gitignore file.
27
|--nodemon.json // Nodemon configurations.
28
|--package.json
29
|--package-lock.json
30
|--tsconfig.json // Typescript config file.
31
​
32
​
33
_________________________
34
13 directories, 21 files
Copied!

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
Copy link