I've built a REST API backend using Django and am now at the stage of designing a client facing frontend. Though, I can't seem to understand how this client frontend should be structured and which languages it should use.
PHP is server-side, and is usually used as the language for building backends. When coupled with a framework such as Codeigniter, it can also be used to play around with sessions, route URLs, and decide which templates to use. Though, I don't believe it can be used to call my REST API to fetch resources (might be wrong here, correct me please if I am).
Javascript is client facing but is used only once the webpage has been fetched from the server. AngularJS is great, but from what I've read, it seems it only helps add very dynamic functionality into already rendered static pages.
I am really open to any ideas, suggestions, and advice based on your experiences creating client frontends. So, back to my original question, how does one structure a REST client frontend, which language is best for this goal, and if which frameworks should one consider to use?
Update 1
Someone asked whether this client frontend will be run in a browser -- the answer is yes, it will. I am trying to build a Twitter-like web client frontend that interacts with a Twitter-like REST API backend. Basically, everything you see there when you go on Twitter's website.
I've built a REST API backend using Django and am now at the stage of designing a client facing frontend. Though, I can't seem to understand how this client frontend should be structured and which languages it should use.
PHP is server-side, and is usually used as the language for building backends. When coupled with a framework such as Codeigniter, it can also be used to play around with sessions, route URLs, and decide which templates to use. Though, I don't believe it can be used to call my REST API to fetch resources (might be wrong here, correct me please if I am).
Javascript is client facing but is used only once the webpage has been fetched from the server. AngularJS is great, but from what I've read, it seems it only helps add very dynamic functionality into already rendered static pages.
I am really open to any ideas, suggestions, and advice based on your experiences creating client frontends. So, back to my original question, how does one structure a REST client frontend, which language is best for this goal, and if which frameworks should one consider to use?
Update 1
Someone asked whether this client frontend will be run in a browser -- the answer is yes, it will. I am trying to build a Twitter-like web client frontend that interacts with a Twitter-like REST API backend. Basically, everything you see there when you go on Twitter's website.
Share Improve this question edited Feb 22, 2015 at 3:17 heapoverflow asked Feb 22, 2015 at 2:46 heapoverflowheapoverflow 1,0523 gold badges9 silver badges15 bronze badges 4- Read restapitutorial. ? – Sulthan Allaudeen Commented Feb 22, 2015 at 2:59
- You need to bound the client-side problem a bit here. Are you delivering an app in a browser? Or are you building a native application (that doesn't run in a browser) and uses some other run-time environment? If the app lives in a browser, then use Ajax calls from the browser to talk to your REST API. – jfriend00 Commented Feb 22, 2015 at 3:02
- @jfriend00 Yes, the frontend will be an app in a browser. I am trying to build a Twitter-like web client frontend that interacts with a Twitter-like REST API backend. Basically, everything you see there when you go on Twitter's website. – heapoverflow Commented Feb 22, 2015 at 3:19
- You have to have the ability to serve up web pages from the back-end. Even if it's only a shell of a page, it has to at least contain all the client-side Javascript so you can then use Ajax calls to call your REST API, gets some data from the back-end, format it into HTML and then display it in the browser. More monly you would serve more HTML than that from the back-end and then use client-side JS to fetch updates and to respond to user actions. Right now, I'm afraid your question is way, way too broad for StackOverflow. It sounds like you're asking how does one build a website. – jfriend00 Commented Feb 22, 2015 at 3:24
3 Answers
Reset to default 2Since it is a browser frontend I would go with HTML/JavaScript only. No need to use PHP or any server side language IMHO. This has the advantage of being extremely portable.
I would also use a JS framework for that purpose ( the trend nowadays seems to be angular).
REST really, really isn't new. It's been a part of HTTP at least as far back as HTTP 1.1
Have a look at this question: Backbone.js frontend with RESTful Rails backend? the top answer lists 20 possible frameworks for building a front end.
Thanks for your help, everyone. Found exactly what I was looking for here: http://docs.python-requests/en/latest/
A nice little library for Python that allows me to basically make calls to a REST backend from within a Django application, which serves as my frontend.
AngularJS will also be used for to make the static pages that Django returns more dynamic. Why? Because AngularJS by itself can be the plete solution only if your whole site consists of one page. If you have multiple pages where each one has it's own set of dynamic elements, you need a bination of Django and AngularJS.
Apparently REST is still quite new and it seems there aren't many people that have stumbled upon this very fundamental question like I have.
Once again, thanks!