Spaces:
Running
Running
import subprocess | |
import os | |
# Define the port and Node.js command | |
port = os.getenv("PORT", 7860) # Default to 7860 if PORT is not set | |
node_command = ["node", "server.js"] | |
# Start the Node.js application | |
try: | |
print(f"Starting Node.js server on port {port}...") | |
subprocess.run(node_command, check=True) | |
except Exception as e: | |
print(f"Error running Node.js server: {e}") |