0

As the title says, how can I make safe and secure requests to my Node server hosted by Heroku? My frontend is currently being hosted on Netlify? Can someone please explain how I can approach this?

Javascriptify
  • 39
  • 1
  • 5

1 Answers1

0

The approach will be the exactly the same as if you were running this server on localhost. Just use the URL of the Heroku app.

fetch('herokup_app_URL')
    .then(res => res.json())
    .then(data => doSomething());
CalamityAdam
  • 304
  • 3
  • 11
  • Thank you! But how do I make so no one else but the frontend I am hosting can make requests? – Javascriptify Oct 31 '19 at 10:16
  • The basic Idea is authentication/authorization. _anyone_ can make a request to your backend, but you'll only respond to authorized requests. by the way, this is true of ANY website you visit. There is no such thing as client security, that has to be handled server-side. anybody can inspect network data in Dev Tools and then make their own request, but you'll only respond to authorized requests. see: https://stackoverflow.com/questions/549/the-definitive-guide-to-form-based-website-authentication/ – CalamityAdam Oct 31 '19 at 13:02