Я строю простой сервер Node.js с помощью Express, Cors и MySQL. Я также обслуживаю статические файлы, такие как index.html из папки Public .[code]const express = require('express'); const cors = require('cors'); const path = require('path'); const mysql = require('mysql');
const app = express(); app.use(cors());
// MySQL connection const con = mysql.createConnection({ host: "localhost", user: "root", password: "", database: "forum" });
app.listen(3000, () => { console.log('Server is running on port 3000'); }); //
< /code> У меня есть два основных вопроса: < /p> Is this structure reasonable for a simple backend?
Are there best practices I'm missing (especially regarding connection handling, CORS, or static file serving)? [/code] Я ценю любые советы или предложения для улучшения!