feat: implement deployment workflow and configure PM2 for backend and frontend applications
This commit is contained in:
14
frontend/ecosystem.config.js
Normal file
14
frontend/ecosystem.config.js
Normal file
@@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
apps: [{
|
||||
name: 'portfolio-frontend', // A name for your application in PM2
|
||||
script: 'npm', // Tell PM2 to run an npm command
|
||||
args: 'start', // The argument to pass to npm, which runs 'next start'
|
||||
instances: 1, // Run a single instance of the application
|
||||
autorestart: true, // Automatically restart if the app crashes
|
||||
watch: false, // Do NOT watch for file changes in production
|
||||
max_memory_restart: '512M', // Restart if it uses more than 512MB of RAM
|
||||
env: {
|
||||
NODE_ENV: 'production', // Set the environment to production
|
||||
}
|
||||
}]
|
||||
};
|
||||
@@ -8,7 +8,6 @@ export default function Contact() {
|
||||
const t = useTranslations('contact');
|
||||
const [formData, setFormData] = useState<{ name: string; email: string; message: string }>({ name: '', email: '', message: '' });
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:3001';
|
||||
|
||||
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
||||
setFormData({...formData, [e.target.name]: e.target.value });
|
||||
@@ -31,7 +30,7 @@ export default function Contact() {
|
||||
|
||||
const submissionPromise = async () => {
|
||||
try {
|
||||
const response = await fetch(`${backendUrl}/api/email/send`, {
|
||||
const response = await fetch(`/api/email/send`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(formData),
|
||||
|
||||
Reference in New Issue
Block a user