You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-6Lines changed: 40 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ To find out more about the Clock of Change and Human Connection - the network be
11
11
* Express.js: We use the [Express.js](https://expressjs.com/en/) framework - a Node.js framework to help build web applications
12
12
* Nodemon: We use [Nodemon](https://nodemon.io/) for development - a handy replacement wrapper for Node.js that automatically restarts the application on file changes
13
13
* MySQL: We use [MySQL](https://www.mysql.com) as our relational database of choice to store our data
14
-
14
+
* MailHog: We use [MailHog](https://github.com/mailhog/MailHog) to debug and preview the email communication
15
15
16
16
## Project Structure & Components
17
17
@@ -21,7 +21,9 @@ To find out more about the Clock of Change and Human Connection - the network be
21
21
* core/: The core directory contains the most important files of the project like database, mailer, router and main controller
22
22
* core/entryController.js: Is the main controller for all the requests
23
23
* core/restapi.js: All routes can be found here, they will also be listed further down
24
+
* documentation/: Documentation for the Clock of Change API
24
25
* mails/: The mails directory holds the mail templates
26
+
* migrations/: Migrations for the database
25
27
* public/: The public directory is not used for now
26
28
27
29
@@ -31,23 +33,55 @@ We use MySQL for the COC API as our relational database.
31
33
Currently all of the database related code can be found in the `core/db.js` file.
32
34
This includes the credentials for the database (host, user, password and db name) and can be changed in this file.
33
35
34
-
TODO: Add description of tables
36
+
More conveniently the MySQL credentials can be provided via environment variables. Use the following environment variables:
37
+
* MYSQL_HOST: Host address for the database
38
+
* MYSQL_DB: Database Name
39
+
* MYSQL_USER: MySQL User
40
+
* MYSQL_PASS: MySQL Password
41
+
42
+
Currently we have two tables:
43
+
* apikeys: Contains the apikeys required to perform authorized API request
44
+
* entries: Stores the user entries for the Clock of Change
45
+
46
+
For more information about the tables, see the SQL dump of the tables at `documentation/tables.sql` .
35
47
36
48
**MAILER**
37
49
38
50
The code related to the mail system can be found in the file `core/mailer.js`.
39
51
For the mailer to work the smtp credentials need to be changed in this file as well.
40
52
Then the mailer will work and use the mail templates from `mails/entry/`
41
53
54
+
More conveniently the Mailer credentials can be provided via environment variables. Use the following environment variables:
55
+
* MAIL_HOST: Host address for the mailer
56
+
* MAIL_PORT: Port number for the mailer
57
+
* MAIL_USER: Mailer User
58
+
* MAIL_PASS: Mailer Password
59
+
60
+
61
+
To debug and preview the emails, we use [MailHog](https://github.com/mailhog/MailHog).
62
+
When installing the Clock of Change without Docker, you have to install MailHog manually (see link for details).
63
+
Then set the host address of MailHog in the Clock of Change API and use `1025` as the port number.
64
+
Assuming MailHog is running on localhost, you can then debug the mails under [http://localhost:8025/](http://localhost:8025/).
42
65
43
66
## Installation
44
67
45
68
**PREREQUESITES**
46
69
47
-
Before starting the installation you need to make sure you have the following tools installed:
48
-
* Git: You need to have Git installed. You can check this in the console with `git --help`. For installation instructions visit https://git-scm.com/
49
-
* Node.js: You need to have Node.js installed. You can check this in the console with `node -v`. For installation instructions visit https://nodejs.org/en/
50
-
* Npm: You need to have npm installed. You can check this in the console with `npm -v`. For installation instructions head to https://www.npmjs.com/get-npm
70
+
Before starting the installation you need to make sure you have a recent version of [Git](https://git-scm.com/), [Nodejs](https://nodejs.org/en/) and [Npm](https://www.npmjs.com/get-npm) installed.
0 commit comments