refactor: restructure entire project for human maintainability

Server:
- Add Express framework, replace custom router/request parser
- Create DAO layer (12 files) centralizing all 73 SQL queries
- Rewrite 7 route files as thin Express controllers calling DAOs
- Add SCF-to-Express adapter (lib/serverless.js)
- Add auth middleware (middleware/auth.js)
- Remove dead code from lib/auth.js

Admin console:
- Extract DataTable component (table + pagination)
- Extract ConfirmModal component (modal + form styles)
- Create listMixin for paginated list pages
- Move form styles to common.css for slot compatibility
- Refactor device + subscription pages as examples

Miniprogram:
- Split 734-line BLE monolith into 4 focused modules
  (protocol, connection, commands, barrel index)
- Create API module (utils/api.js) with named functions
- Create page utilities (utils/page.js)
- Refactor index + profile pages to use API module
这个提交包含在:
Guoguo
2026-04-29 05:58:20 -07:00
父节点 9f0e629c82
当前提交 bb4b80f867
修改 46 个文件,包含 4306 行新增2020 行删除
+3 -22
查看文件
@@ -1,27 +1,8 @@
require('dotenv').config({ path: require('path').join(__dirname, '..', '.env') })
const http = require('http')
const config = require('../src/config')
const { handle } = require('../src/app')
const app = require('../src/app')
const server = http.createServer(async (req, res) => {
const chunks = []
req.on('data', chunk => chunks.push(chunk))
req.on('end', async () => {
const url = new URL(req.url, 'http://localhost')
const event = {
httpMethod: req.method,
path: url.pathname,
headers: req.headers,
queryStringParameters: Object.fromEntries(url.searchParams.entries()),
body: Buffer.concat(chunks).toString('utf8')
}
const result = await handle(event)
res.writeHead(result.statusCode, result.headers)
res.end(result.body || '')
})
})
server.listen(config.port, () => {
console.log('SCF local server listening on http://localhost:' + config.port)
app.listen(config.port, () => {
console.log('Server listening on http://localhost:' + config.port)
})