Skip to content

Commit 4367b3c

Browse files
committed
Update route.js RESEND_API_KEY
1 parent 7ae0c2d commit 4367b3c

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

App/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ COPY . .
2121
# Build the app
2222
RUN npm run build
2323

24-
# Set the environment to production
25-
ENV NODE_ENV=production
26-
2724
# Expose the port the application listens on
2825
EXPOSE 3000
2926

27+
# Set the environment to production
28+
ENV NODE_ENV=production
29+
3030
# Run the web service on container startup.
3131
CMD [ "npm", "start" ]

App/docker-compose.yaml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,9 @@ version: "3.9"
22

33
services:
44
portfolio:
5-
image: fjrodafo/portfolio:latest
6-
7-
build:
8-
context: .
9-
dockerfile: Dockerfile
10-
11-
container_name: portfolio
12-
5+
build: .
136
ports:
147
- "3000:3000"
15-
168
env_file:
179
- .env
18-
19-
environment:
20-
NODE_ENV: production
21-
2210
restart: unless-stopped

App/src/app/api/send/route.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
import { Resend } from 'resend';
22

3-
const resend = new Resend(process.env.RESEND_API_KEY);
3+
let resend;
4+
if (process.env.RESEND_API_KEY) {
5+
resend = new Resend(process.env.RESEND_API_KEY);
6+
}
47

58
export async function POST(req) {
9+
if (!resend) {
10+
return new Response(JSON.stringify({
11+
success: false,
12+
error: "RESEND_API_KEY not set"
13+
}), { status: 500 });
14+
}
15+
616
try {
717
const { name, email, project } = await req.json();
818

@@ -14,9 +24,9 @@ export async function POST(req) {
1424
text: project,
1525
});
1626

17-
return Response.json({ success: true, data });
27+
return new Response(JSON.stringify({ success: true, data }), { status: 200 });
1828
} catch (error) {
1929
console.error('Error sending email:', error);
20-
return Response.json({ success: false, error }, { status: 500 });
30+
return new Response(JSON.stringify({ success: false, error }), { status: 500 });
2131
}
2232
}

0 commit comments

Comments
 (0)