Added NodeJS Server files
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
const mariadb = require('mariadb');
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
app.use(bodyParser.json());
|
||||
const serverPort = 3000;
|
||||
|
||||
const databaseCredentials = {
|
||||
@@ -11,7 +13,7 @@ const databaseCredentials = {
|
||||
database: 'fitbot',
|
||||
connectionLimit: 5,
|
||||
allowUnauthorized: true
|
||||
}
|
||||
};
|
||||
|
||||
// Create connection pool
|
||||
const pool = mariadb.createPool(databaseCredentials);
|
||||
@@ -20,6 +22,6 @@ const pool = mariadb.createPool(databaseCredentials);
|
||||
require('incoming_request_handlers')(app, pool);
|
||||
|
||||
// Start server
|
||||
app.listen(port, () => {
|
||||
app.listen(serverPort, () => {
|
||||
console.log(`Server running on port ${serverPort}`);
|
||||
})
|
||||
});
|
Reference in New Issue
Block a user