By larrylines
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!
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);
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.