How to use RequireJS in AngularJS Application?

To use AngularJS in my app I have to expose an API publicly, and data is the USP of my application. I don't want someone to easily use all the data. Is there any alternative?

  • Answer:

    Use a middle layer of Node.js ( Express Framework ) to call your api securely. So maybe if you have a model with 6 sub models associated with it, you can call and aggregate that data at one place and let AngularJS call this route which have aggregated data. It will save your users multiple REST calls request and website response time will be much faster. This way you can secure the Rails routes to be directly get called and exposed. Use UUID for primary key which prevents users not able to guess next id and can save you. Save IP address of user and generate a token based on that. Use Session based API requests. And trust me, whatever maybe the situation, there is always a way to scrap data from a website unless it's a protected website which requires a login. So, I guess you should focus on building the product and let it go because someone who is a good scraper can really collect all your data no-matter what just like a good hacker can get into facebook, twitter and look at users data. I have scrapped Zomato data and their website is secure in my opinion :)

Piyush Chauhan at Quora Visit the source

Was this solution helpful to you?

Other answers

You can have a separate backend let's say ror. Then after you just need to write promises as part of angular services. This is how you can keep ur data safe by using some secure db at backend

Aditya Sethi

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.