TypeError: Unexpected ( at 9, expected END: https://git.new/pathToRegexpError #6492
JonathanGech
started this conversation in
General
Replies: 2 comments
-
app.get('/newpage(.html)?', (req, res) => { This how i setup |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey, is .html an optional parameter? You may try : |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey devs I am new to express js and I don't know some stuff,.
How could i fix this
app.get(
/newpage(.html)?
, (req, res) => {res.sendFile(path.join(__dirname, "views", "newpage.html"));
});
it showing me error
Nodejs\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 (E:\Nodejs\node_modules\path-to-regexp\dist\index.js:123:15)
at consume (E:\Nodejs\node_modules\path-to-regexp\dist\index.js:179:16)
at parse (E:\Nodejs\node_modules\path-to-regexp\dist\index.js:183:20)
at E:\Nodejs\node_modules\path-to-regexp\dist\index.js:294:74
at Array.map ()
at pathToRegexp (E:\Nodejs\node_modules\path-to-regexp\dist\index.js:294:25)
at Object.match (E:\Nodejs\node_modules\path-to-regexp\dist\index.js:264:30)
at matcher (E:\Nodejs\node_modules\router\lib\layer.js:86:23)
at new Layer (E:\Nodejs\node_modules\router\lib\layer.js:93:62)
at Function.route (E:\Nodejs\node_modules\router\index.js:428:17)
Beta Was this translation helpful? Give feedback.
All reactions