-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: - event deletion removed from the scheduler - validations for lead revoking itself, dates, restrict update of some fields, max registrations. - reduce events code hash length. - delete event image key instead of replacing it from amazon s3 when an event is deleted. - some checks for certificate metadata/ New: - deploy script. - worker clusters - modular email service
- Loading branch information
Showing
11 changed files
with
227 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
const express = require("express"); | ||
const bodyParser = require("body-parser"); | ||
const compression = require("compression"); | ||
const morgan = require("morgan"); | ||
const path = require("path"); | ||
const helmet = require("helmet"); | ||
const { NODE_ENV, PORT } = require("./config/index"); | ||
const { notFound, sendErrors } = require("./config/errorHandler"); | ||
const kue = require("kue"); | ||
const app = express(); | ||
|
||
const cors = require("cors"); | ||
require("dotenv").config(); | ||
require("./config/dbconnection"); | ||
|
||
module.exports = () => { | ||
app.use(compression()); | ||
app.use(helmet()); | ||
app.use(morgan("dev")); | ||
app.use(cors({ exposedHeaders: "x-auth-token" })); | ||
app.use(express.static(path.join(__dirname, "public"))); | ||
app.use( | ||
bodyParser.urlencoded({ | ||
limit: "50mb", | ||
extended: true, | ||
parameterLimit: 1000000 | ||
}) | ||
); | ||
app.use( | ||
bodyParser.json({ | ||
limit: "50mb", | ||
extended: true, | ||
parameterLimit: 1000000 | ||
}) | ||
); | ||
app.use("/kue-cli", kue.app); | ||
|
||
if (NODE_ENV === "production") { | ||
console.log = console.warn = console.error = () => {}; | ||
} | ||
|
||
//load Schemas | ||
const User = require("./models/User"); | ||
const Participant = require("./models/Participant"); | ||
const Event = require("./models/Event"); | ||
const Attendance = require("./models/Attendance"); | ||
const Feedback = require("./models/Feedback"); | ||
const ResetToken = require("./models/ResetToken"); | ||
const Subscriber = require("./models/Subscriber"); | ||
const Subscription = require("./models/Subscription"); | ||
|
||
//Routes | ||
app.use("/api/v1", require("./routes/api/v1/index")); | ||
app.use("/api/v1/users", require("./routes/api/v1/users")); | ||
app.use("/api/v1/events", require("./routes/api/v1/events")); | ||
app.use("/api/v1/subscription", require("./routes/api/v1/subscription")); | ||
|
||
app.use("*", notFound); | ||
|
||
//Error Handlers | ||
app.use(sendErrors); | ||
|
||
// Allowing headers | ||
app.use((req, res, next) => { | ||
res.header("Access-Control-Allow-Origin", "*"); | ||
res.header( | ||
"Access-Control-Allow-Headers", | ||
"Origin, X-Requested-With, Content-Type, Accept" | ||
); | ||
res.header("Access-Control-Allow-Credentials", true); | ||
res.header( | ||
"Access-Control-Allow-Methods", | ||
"GET, POST, PUT, DELETE, PATCH, OPTIONS" | ||
); | ||
next(); | ||
}); | ||
|
||
//Setting up server | ||
(async () => { | ||
try { | ||
await app.listen(PORT); | ||
console.info( | ||
`NODE_ENV: ${NODE_ENV}\nServer is up and running on Port ${PORT}` | ||
); | ||
} catch (err) { | ||
console.info("Error in running server.", err); | ||
} | ||
})(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.