const express = require('express')
const app = express()
const path = require('path')
const PORT = process.env.PORT || 3000
app.get('/old-page(.html)?',(req,res)=>{
res.send("hi");
})
app.listen(PORT,(req,res)=>{
console.log(`The server is running in the port ${PORT}`);
})
< /code>
Ошибка, которую я получаю: < /p>
C:\Express JS\node_modules\path-to-regexp\dist\index.js:123
throw new TypeError(`Unexpected ${nextType} at ${index}, expected ${type}: ${DEBUG_URL}`);
^
TypeError: Unexpected ( at 9, expected END: https://git.new/pathToRegexpError
at Iter.consume (C:\Express JS\node_modules\path-to-regexp\dist\index.js:123:15)
at consume (C:\Express JS\node_modules\path-to-regexp\dist\index.js:179:16)
at parse (C:\Express JS\node_modules\path-to-regexp\dist\index.js:183:20)
at C:\Express JS\node_modules\path-to-regexp\dist\index.js:294:74
at Array.map ()
at pathToRegexp (C:\Express JS\node_modules\path-to-regexp\dist\index.js:294:25)
at Object.match (C:\Express JS\node_modules\path-to-regexp\dist\index.js:264:30)
at matcher (C:\Express JS\node_modules\router\lib\layer.js:86:23)
at new Layer (C:\Express JS\node_modules\router\lib\layer.js:93:62)
at Function.route (C:\Express JS\node_modules\router\index.js:428:17)
app.listen(PORT,(req,res)=>{ console.log(`The server is running in the port ${PORT}`); }) < /code> Ошибка, которую я получаю: < /p> C:\Express JS\node_modules\path-to-regexp\dist\index.js:123 throw new TypeError(`Unexpected ${nextType} at ${index}, expected ${type}: ${DEBUG_URL}`); ^
TypeError: Unexpected ( at 9, expected END: https://git.new/pathToRegexpError
at Iter.consume (C:\Express JS\node_modules\path-to-regexp\dist\index.js:123:15) at consume (C:\Express JS\node_modules\path-to-regexp\dist\index.js:179:16) at parse (C:\Express JS\node_modules\path-to-regexp\dist\index.js:183:20) at C:\Express JS\node_modules\path-to-regexp\dist\index.js:294:74 at Array.map () at pathToRegexp (C:\Express JS\node_modules\path-to-regexp\dist\index.js:294:25) at Object.match (C:\Express JS\node_modules\path-to-regexp\dist\index.js:264:30) at matcher (C:\Express JS\node_modules\router\lib\layer.js:86:23) at new Layer (C:\Express JS\node_modules\router\lib\layer.js:93:62) at Function.route (C:\Express JS\node_modules\router\index.js:428:17) [/code] node.js v22.14.0
import express from express ;
const app = express();
import dotenv from dotenv ;
import path from path ;
let _dirname = path.resolve();
import cors from cors
import { router } from ./routes.js ;
import connectDB from ./src/helper/dbConnection.js ;...
Дано регулярное выражение, которое было сделано без учета регистра с помощью флага i или (?i) и которое содержит группы захвата, как в следующем примере:
(?i)username: (?\S) role: (?\S)
гарантированно ли, что извлеченные из него фрагменты будут в...