2

Lets say I'm building a site similar to this or Quora (or some arbitrary blog-like site). I need a real-time component that will be using web-sockets/long-polling to notify the user of new posts, questions, etc. depending on what page the user is viewing. That real time component will essentially be the site's API implemented in something like Twisted or Java NIO, and the site's web server will be sitting in front of say Flask or Pyramid.

Should the API and webpages be served by the same component or is it best to keep them separate?

(I'm asking both logically and physically)

Giorgio
19.8k16 gold badges89 silver badges137 bronze badges
asked Jul 30, 2014 at 18:02

1 Answer 1

3

Logically, it doesn't matter where the service comes from. Conceptually you can think of the web pages being served as simply another service.

What does matter is that the service is built in such a way that it can be used independently of other services. In other words, it wouldn't make much sense to have a public API that only works if you must also accept the web pages it serves.

Physically, it might matter for reasons of scalability or location. Aside from that, nothing prevents you from having both a public web API and your web pages in the same application, on the same machine.

answered Jul 30, 2014 at 18:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.