Report this

What is the reason for this report?

authenticate with express, passport, jwt, etc

Posted on April 5, 2021

I followed this tutorial step by step: https://www.digitalocean.com/community/tutorials/api-authentication-with-json-web-tokensjwt-and-passport

When I was done, I used postman. ipaddress/signup with the appropriate body variables

I get a 404 error. I did some other parts. I can see that the app.use(/, routes) method works. I put a hello world block in the routes.js to see if it was being reached. It worked.

router.get(‘/’, function (req, res) { res.send(‘hello world’) });

I’m new to node.js, so I am open to user error, but I have been doing web development for some time. I have even used nodejs in other contexts. This has got to be my fourth or fifth attempt to figure out this express, router, JWT thing. I need to be able to authenticate, so I have to figure this out. I figured using digital ocean’s tutorial was a good start. Every other tutorial I have used works. But those are admin tasks.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey, @larrylines it’s hard to say without seeing your routing table. Make sure that you don’t declare any wildcard routes before your signup route.

This:

app.get("/s*", fooRoute);

would overwrite this:

app.get("/signup", signupRoute);

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.