skip to Main Content

Express and MySql

When I'm sending a POST request to MySql database, it adds the product but it shoots me with that error. Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at new NodeError (node:internal/errors:387:5) at ServerResponse.setHeader (node:_http_outgoing:603:11) at…

VIEW QUESTION

Mongodb aggregation response

I have a Property controller : //Get Properties By Type const getPropertiesByType = async (req: Request, res: Response) => { const { cities, type } = req.query const citiesArr = typeof cities === 'string' ? cities.split(',') : [] try {…

VIEW QUESTION

Mongodb – new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn))

I have tried to run this code: const connectToMongo = require('./db') const express = require('express') connectToMongo(); const app = express() const port = 3000 // Available Routes app.use('/api/auth', require('./routes/auth')) app.use('/api/notes', require('./routes/notes')) app.listen(port, () => { console.log(`Example app listening on port…

VIEW QUESTION
Back To Top
Search