Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key

REDIS_URL=your_url_for_redis eg. redis://localhost:6379

FRONTEND_URL=your_frontend_url eg. http://localhost:3000
1 change: 1 addition & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
REFRESH_EXPIRES_IN: "7d"
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
FRONTEND_URL: "http://localhost:3000"

build-and-push:
name: Build and push to Docker Hub
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ node_modules

/logs

NotifierAPI_Documentation.md
NotifierAPI_Documentation.md
FRONTEND_API_DOCS.md
27 changes: 27 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@supabase/supabase-js": "^2.101.1",
"bcryptjs": "^3.0.3",
"cookie-parser": "^1.4.7",
"cors": "^2.8.6",
"crypto": "^1.0.1",
"dotenv": "^17.3.1",
"express": "^5.2.1",
Expand Down
10 changes: 10 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import express from "express";
import cookieparser from "cookie-parser";
import { connectRedis } from "./config/redis.js";
import helmet from "helmet";
import cors from "cors";

// Import routes
import authRoutes from "./routes/auth.js";
Expand All @@ -21,6 +22,15 @@ import { requestLogger } from "./middlewares/requestLogger.js";

const app = express();

app.use(
cors({
origin: process.env.FRONTEND_URL,
credentials: true,
allowedHeaders: ["Content-Type", "Authorization"],
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
}),
);

app.use(
helmet({
contentSecurityPolicy: false,
Expand Down
2 changes: 2 additions & 0 deletions src/config/envValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const envSchema = z.object({
SUPABASE_URL: z.string().url(),
SUPABASE_SERVICE_ROLE_KEY: z.string().min(20),
REDIS_URL: z.string().url(),

FRONTEND_URL: z.string().url(),
});

const _env = envSchema.safeParse(process.env);
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/users/getAll.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const getUsers = async (req, res) => {
select: {
id: true,
name: true,
email: true,
isEmailVerified: true,
role: true,
isDeleted: true,
profilePictureUrl: true,
updatedAt: true,
Expand Down
1 change: 1 addition & 0 deletions src/controllers/users/getMyself.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const getMyself = async (req, res) => {
id: true,
name: true,
email: true,
role: true,
isEmailVerified: true,
profilePictureUrl: true,
updatedAt: true,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/sendVerificationEmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const sendVerificationEmail = async (user) => {
},
});

const verifyUrl = `${env.BASE_URL}/auth/verify-email?token=${verificationToken}`;
const verifyUrl = `${env.FRONTEND_URL}/verify-email?token=${verificationToken}`;

await sendEmail({
email: user.email,
Expand Down
Loading