Reputation: 731
How can I build rest API with nodejs and limit user access with whitelisted ip or domain?
so, if domain or ip address not whitelisted, they cant access the API. anything I need to build that?
Upvotes: 2
Views: 2823
Reputation: 801
If I'm understanding your question correctly, you want to whitelist domains that can make cross-origin requests to your API.
You can use something like NPM's CORS package, which will let you develop a request whitelist and reject calls from unapproved origins.
Upvotes: 3