Fleshed out API, added simple email support.

This commit is contained in:
2018-07-04 08:17:12 +10:00
parent aa532e0fc8
commit 13982239d4
12 changed files with 343 additions and 7 deletions

View File

@ -26,7 +26,8 @@ const
path = require('path'),
ConfigurationManager = require('./../configuration/ConfigurationManager'),
DatabaseConnection = require('./../database/DatabaseConnection'),
Server = require('./../server/Server')
Server = require('./../server/Server'),
Email = require('./../email/Email')
;
//Constants
@ -42,6 +43,7 @@ class App {
getPublicDirectory() { return PUBLIC_PATH; }
getServer() { return this.server; }
getAPI() { return this.getServer().getAPI(); }
getEmail() {return this.email;}
//Primary Functions
async start() {
@ -68,6 +70,17 @@ class App {
throw new Error(e);
}
//Connect to our SMTP Host (For sending mail)
try {
console.log('Connecting to SMTP Server');
this.email = new Email(this);
await this.email.connect();
console.log('...Done');
} catch(e) {
console.error("Failed to setup emails!");
throw new Error(e);
}
//Now we need to start the server. This provides both a nice interface, as
//well as our API Handler (including 2auth callback urls)
try {