File tree Expand file tree Collapse file tree 3 files changed +17
-19
lines changed
Expand file tree Collapse file tree 3 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ COPY . .
2121# Build the app
2222RUN npm run build
2323
24- # Set the environment to production
25- ENV NODE_ENV=production
26-
2724# Expose the port the application listens on
2825EXPOSE 3000
2926
27+ # Set the environment to production
28+ ENV NODE_ENV=production
29+
3030# Run the web service on container startup.
3131CMD [ "npm" , "start" ]
Original file line number Diff line number Diff line change @@ -2,21 +2,9 @@ version: "3.9"
22
33services :
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
Original file line number Diff line number Diff line change 11import { 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
58export 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}
You can’t perform that action at this time.
0 commit comments