Node.js Connector TypeError: res.status is not a function


I am learning JS scripting and am making a RESTful API with the MariaDB Node.js Connector and Express.js.
But I am stuck on the above mentioned error it has to do with this line ".then((res) =>" because if I do this " .then(() =>" I get no error.
But I also don't get the "res.insertId" in the console.log. What I get is "User added with ID: undefined".
Thanks in advance.

Dimitris'/users', (req, res) => {
            .then(conn => {
            conn.query('INSERT INTO users values(?,?,?,?,?)', [ '', 123, 'testuser' ,'' ,'user'])
            .then((res) => {
                res.status(201).send(`User added with ID: ${res.insertId}`) //error on this line "TypeError: res.status is not a function"
                console.log(`User added with ID: ${res.insertId}`)
                console.log('conn end')
            .catch(err => {
                console.log('conn end with error')


Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.