- Layered API (router -> controller -> model -> db), serverlinkr pattern - Public / auth / admin route groups; posts, wiki, settings, users, activity models - JWT httpOnly-cookie auth (Secure auto-detected: LAN HTTP + Pangolin HTTPS) - Site LIVE/MAINTENANCE mode with admin preview bypass - Dual file+console logging (info/warn/error/debug) + HTTP access logs - Docker Compose (app + MariaDB), schema.sql + seed, .env.example - Verified end-to-end against MariaDB (27/27 smoke checks) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
13 lines
350 B
JavaScript
13 lines
350 B
JavaScript
const { validationResult } = require('express-validator')
|
|
|
|
// Collect express-validator results and 400 on failure.
|
|
function validate(req, res, next) {
|
|
const errors = validationResult(req)
|
|
if (!errors.isEmpty()) {
|
|
return res.status(400).json({ message: 'Validation failed', errors: errors.array() })
|
|
}
|
|
next()
|
|
}
|
|
|
|
module.exports = validate
|