refactor(esm): migrate server and tests from CommonJS to ESM
Convert all server/, test, and setup files from require()/module.exports to import/export syntax. Activate ESM globally via "type": "module" in package.json and load dotenv via --import dotenv/config in npm scripts.
This commit is contained in:
@@ -11,9 +11,7 @@
|
||||
* 5. GET/HEAD/OPTIONS sind ausgenommen (safe methods).
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const crypto = require('node:crypto');
|
||||
import crypto from 'node:crypto';
|
||||
|
||||
const TOKEN_LENGTH = 32; // Bytes → 64 Hex-Zeichen
|
||||
|
||||
@@ -68,4 +66,4 @@ function csrfMiddleware(req, res, next) {
|
||||
next();
|
||||
}
|
||||
|
||||
module.exports = { csrfMiddleware, generateToken };
|
||||
export { csrfMiddleware, generateToken };
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
* Abhängigkeiten: keine
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Globale Längengrenzen
|
||||
const MAX_TITLE = 200;
|
||||
const MAX_TEXT = 5000;
|
||||
@@ -158,7 +156,7 @@ function id(val, field) {
|
||||
return { value: n, error: null };
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export {
|
||||
str, oneOf, date, time, datetime, month, num, color, rrule, id, collectErrors,
|
||||
MAX_TITLE, MAX_TEXT, MAX_SHORT, MAX_RRULE,
|
||||
DATE_RE, TIME_RE, DATETIME_RE, COLOR_RE, MONTH_RE,
|
||||
|
||||
Reference in New Issue
Block a user