5

Im new to RESTful API's and would like to find some info out.

Currently we run a daily digest of eHealth material for the public to read and get up to date content regarding that topic. Which is powered by Laravel 5.2 and a MySQL Database.

We have a linux based server which is hosted with an ISP currently runs 8GB Ram, Core i7 processor.

My boss has suggested we start using API's as the middleman between our apps as we have moved over to mobile and our readership is growing as we now support users which have access to a wide variety of functions.

My question is: Is it smart to run your web application and API on the same server. I suggested renting another server, moving our database across to it and then building the API to sit there and serve content. However my boss has advised that another server is out of question due to cost implications.

My thoughts as a developer is why build an API on the same server if the Web App is already connecting via the same server to the DB and querying the content. It just seems like additional work.

Any thoughts would be great.

  • 1
    It gives you the option to move that part to another server later. – Dan Pichelman Jun 13 '16 at 15:09
7

Why build an API on the same server if the Web App is already connecting via the same server to the DB and querying the content.

The purpose of the API is to provide a uniform interface for your local apps and your mobile devices to talk to. It is a software layer, not a physical tier.

Running the API and the application on the same server is perfectly valid, so long as the server can handle the load.

2

I think it's fine. In fact you can use the same application to provide a consistent response. e.g. on my current project the webservice provides HTML responses and JSON responses from the same service, on the same URLs. The means by which it determines what to do and how to respond is purely based on the HTTP Accept headers.

  • Thanx for this comment man. all these responses have helped me make a decision – Wes Murray Jun 14 '16 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.