A web site that pulls info from a web service?

Use Node.js and express.js to write an API that accepts get/post requests. Get params could be site.com/getdata/query1/query2/query3 and the post query could be a json object with

{ "query1" : d323d , "query2" : qwoidqwd, "query3" : wdawdwd }

Add mongodb and mongoose to your Node.js server, write functions for validating requests and sending back only relevant info from mongoose find queries (toJson or something).

Deploy it to heroku and get mongodb there, set up environment variables and the executable for heroku, and voila.

You may add some authentication middleware to get/post routes on your express app();

just add the package cors (app.use(cors()); after requiring it) and that enables Cross Origin Requests , from your mobile app, or your website that's on another domain.

Tailor your error messages, what status to send , what headers to accept, test routes via mocha, supertest and (optional) except.

Now all you have to do is make a request on your front end with Axios or Request (using React/Angular) or make an api request using Alamofire on iOS app. And parse the JSON returned from your server however you like inside the callback function (or the promise resolve)

A few day's to get it all going if you know the frameworks and the languages, but the difficulty part is to populate the data on the database. You could use robomongo to manually enter them, or you could write a new POST route on your Node.js express app, authenticate it for yourself (if you dont want ot use jsonwebtokens , easiest way would be to accept only a made up string in a made up header, and use that string when POST ing to that route. )

So get your data, organize it as an array of JSON objects, then write some short code to POST each member to your API (goes on mongodb and gets a new _id and _v )

Make sure to write your Mongoose Schemas well, they have rules for every field, and methods for instance and statics for Schema (still a method) and middleware, for example before each save query, you can do something with your fields)

After debating whether to save data on ios core data and push updates, or put them on an sql server and use php to process GET requests, I just wrote a Node.js restful api to serve the data I need to all my frontend apps and mobile apps from the same source. It's scalable and I can always quickly edit the project folder rand push to git and heroku within seconds.

/r/Frontend Thread