Created
November 13, 2024 02:03
-
-
Save thanhdevapp/ec19699380503b40e102701e20b67e69 to your computer and use it in GitHub Desktop.
strapi 4, 5 typescript + pm2 script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
apps: [ | |
{ | |
name: "strapi-app-backend-crawler", | |
script: 'server.js', // Điểm khởi động là server.js | |
watch: false, | |
env: { | |
NODE_ENV: "development" | |
}, | |
env_production: { | |
NODE_ENV: "production" | |
} | |
} | |
] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const path = require('path'); // Thêm dòng này để import path | |
const { createStrapi } = require('@strapi/strapi'); | |
async function main() { | |
// Khởi tạo ứng dụng Strapi từ thư mục build | |
const strapi = await createStrapi({ | |
distDir: path.resolve(__dirname, 'dist'), // Thư mục build | |
}); | |
// Bắt đầu chạy ứng dụng Strapi | |
await strapi.start(); | |
} | |
main().catch((error) => { | |
console.error('Error starting Strapi:', error); | |
process.exit(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment