UNPKG

legendaryjs

Version:

LegendaryJS – The ultimate backend framework for speed, power, and simplicity.

33 lines (28 loc) 952 B
const { execSync } = require('child_process'); const chalk = require('chalk'); const fs = require('fs'); const path = require('path'); function loadConfig() { const configPath = path.join(process.cwd(), 'legendary.config.js'); if (!fs.existsSync(configPath)) { console.error(chalk.red('❌ legendary.config.js not found.')); process.exit(1); } return require(configPath); } function startServer() { const config = loadConfig(); try { if (config.dev?.hotReload) { console.log(chalk.green('🔥 Starting server with hot reload...')); execSync(`npx nodemon app.js`, { stdio: 'inherit' }); } else { console.log(chalk.green('🚀 Starting LegendaryJS server...')); execSync(`node app.js`, { stdio: 'inherit' }); } } catch (err) { console.error(chalk.red('❌ Failed to start the server.')); console.error(err.message); } } module.exports = startServer;