Skip to content
Advertisement

Tag: express

Res.send not a function

I have an endpoint (using express) which requires me to do some fetching first. Once a parse the response and use res.send I get an error res.send is not a function. I tried searching for this error but all searches show users had res,req in the wrong order. In this case, mine appear to be right. Why is it res

Couldn’t generate jwt token with a nodejs sign-in

I’m trying to singin with existing user but it shows Cannot POST /api/signin. The same works with signup process and I did cross check the signin route but couldn’t find where exactly the issue occurs. signin code: router : router.get(‘/signin’,signin) app: app.use(‘/api’,authRoutes); Tried calling postman with : localhost:2000/api/signin but dint work. The same route pattern for signup worked localhost:2000/api/signup Answer

How do I send a YAML file as a base64 encoded string?

I am trying to send a yaml file as a base64 string so that this code works: In the above code response.data.content should have the data. I have this route: The code is working fine except that the client code expects the base64 string in a property called content in the following code: But the string is in response.data. How

Trying to run express node js as https server but it won’t run

I’m trying to get HTTPS working on express.js for node, and it won’t run. This is my server.js code. When I run it reports no errors but it just get stuck to nothing (I waited 30 minutes to see if it does something and nothing happened). Answer httpServer.listen(8080, ()=>{console.log(‘Server is running’)}); If the server successfully started, it should output “Server

Why hashing the reset password token?

I have this forgot password handler in my Express app. I send an email with a crypto.randomBytes(20).toString(“hex”) token, that I use later to verify the request. It is working perfectly. However, I have seen that people are hashing this token before sending it and storing in the data base, and I don’t see why, cause it is already a random

Advertisement