lukeed / regexparam

A tiny (394B) utility that converts route patterns into RegExp. Limited alternative to `path-to-regexp` 🙇‍♂️
MIT License
567 stars 23 forks source link

str.split is not a function at app.post #12

Closed Mlocik97 closed 3 years ago

Mlocik97 commented 3 years ago
node_modules/regexparam/dist/regexparam.js:3
        var c, o, tmp, ext, keys=[], pattern='', arr = str.split('/');
                                                           ^

TypeError: str.split is not a function
    at module.exports

when I use

app.post((req, res) => {
    console.log(req.body);
    res.end();
})

in my server.js

lukeed commented 3 years ago

Hi, sorry this is unrelated and also invalid.

Unrelated because had it been an issue, it'd be with your server framework (polka, I presume)

And invalid because you need to specify a route path -- only app.use is allowed to not have a path segment:

app.post('/path', (req, res) => {
    console.log(req.body);
    res.end();
})

Hope that helps!