This repository was archived by the owner on Mar 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
58 lines (51 loc) · 3.02 KB
/
server.js
File metadata and controls
58 lines (51 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*****************************************************************************************
* _________ __ ____ ____ __ .__ *
* / _____/ _____ _____ ________/ |_ \ \ / /____/ |_|__| ____ ____ *
* \_____ \ / \\__ \\_ __ \ __\ \ Y / _ \ __\ |/ \ / ___\ *
* / \ Y Y \/ __ \| | \/| | \ ( <_> ) | | | | \/ /_/ > *
* /_______ /__|_| (____ /__| |__| \___/ \____/|__| |__|___| /\___ / *
* \/ \/ \/ \//_____/ *
*****************************************************************************************
* Project Title: Smart Voting *
* Project Website: https://smartvoting.cc/ *
* Documentation: https://docs.smartvoting.cc/ *
* Project Source Code: https://github.com/smartvoting/ *
*****************************************************************************************
* Project License: GNU General Public License v3.0 *
* Project Authors: Matthew Campbell, Stephen Davis, Satabdi Sangma, Michael Sirna *
* George Brown College - Computer Programmer Analyst (T127) *
* Capstone I & II - September 2021 to April 2022 *
*****************************************************************************************/
require("dotenv").config();
const port = process.env.PORT || 3000;
const version = process.env.API_VERSION;
const AWS = require("aws-sdk");
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const app = express();
const db = require(`./${version}/models`);
const dynamoConfig = require("./config/dynamo.config");
// db.sequelize.sync();
AWS.config.update(dynamoConfig);
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(cors());
app.get("/v1/", (req, res) => {
res.status(202).json({ message: `Smart Voting API Root - ${version}` });
});
// Routes
// require(`./${version}/routes/admin.eo.routes`)(app, version);
// require(`./${version}/routes/admin.lr.routes`)(app, version);
// require(`./${version}/routes/admin.pp.routes`)(app, version);
require(`./${version}/routes/api_keys.routes`)(app, version);
// require(`./${version}/routes/candidate.routes`)(app, version);
// require(`./${version}/routes/election.routes`)(app, version);
require(`./${version}/routes/party.routes`)(app, version);
require(`./${version}/routes/opennorth.routes`)(app, version);
// require(`./${version}/routes/vote.routes`)(app, version);
// require(`./${version}/routes/voter.routes`)(app, version);
require(`./${version}/routes/general.routes`)(app, version);
app.listen(port, () => {
console.log(`server is running at: http://localhost:${port}/${version}/`);
});