Skip to content

Commit

Permalink
Merge pull request #30 from scienmanas/mvp
Browse files Browse the repository at this point in the history
Mvp
  • Loading branch information
scienmanas authored Dec 14, 2024
2 parents 09c5064 + d99297b commit 86f69e8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 30 deletions.
17 changes: 5 additions & 12 deletions Website/Backend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,17 @@ const allowedOrigins = [
"https://certimailer.xyz",
"https://www.certimailer.xyz",
];
const allowedOriginsHitPoint = [
"https://certimailer.xyz",
"https://www.certimailer.xyz",
"https://cron-job.org",
"https://www.cron-job.org",
"http://localhost:3000",
];
const allowedMethods = ["GET", "POST", "PUT", "DELETE"];
const allowedHeaders = ["Content-Type", "Authorization"];

app.use((req: Request, res: Response, next) => {
const origin = req.headers.origin as string | undefined;
console.log(`Request from : ${origin}`);

if (req.url === "/") {
if (origin && allowedOriginsHitPoint.includes(origin))
return res.status(200).json({ message: "200 OK Hello guys :)" }).end();
}
if (req.url === "/")
return res
.status(200)
.json({ message: "CertiMailer server on fire :)" })
.end();

if (origin && allowedOrigins.includes(origin)) {
// Allow the origin if it's in the allowedOrigins list
Expand Down
16 changes: 0 additions & 16 deletions Website/Backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Website/Backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"@types/bcrypt": "^5.0.2",
"@types/bcryptjs": "^2.4.6",
"@types/cookie-parser": "^1.4.7",
"@types/cors": "^2.8.17",
"@types/dotenv": "^6.1.1",
"@types/express": "^4.17.21",
"@types/jsonwebtoken": "^9.0.6",
Expand All @@ -33,7 +32,6 @@
"bcrypt": "^5.1.1",
"bcryptjs": "^2.4.3",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"jsonwebtoken": "^9.0.2",
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 86f69e8

Please sign in to comment.