Appropriate back-end for a single-page web application?
Asked Answered
M

2

10

Historically I've mainly written web apps in Django, but now I'm increasingly finding that I want to write single-page web apps using Backbone.js or a similar JavaScript framework, with a back-end that solely consists of a database and an API.

My questions is this. If my application structure looks like this:

 1. Database
 |
 v
 2. API methods
 |
 v
 3. Single-page front-end written with Backbone

and I'm most comfortable in Django - but also keen to learn new things too, such as NoSQL and Node, if they are appropriate - what would people recommend I use for (2)?

Typically I would use Django with Piston as the API app, but it seems rather heavyweight to have all of Django and only use it as an API provider. Perhaps I shouldn't be worrying, though.

Malave answered 20/6, 2012 at 13:42 Comment(2)
It's relevant to know how large and complex the required API, how much traffic/load you expect on the system. For a smaller, simpler project there could be options for smaller, simpler tools to use.Loanloanda
Flask + Flask-SQLAlchemy + Flask-Restless in place of #2 and you are good to go.Crompton
C
5

If you use Django, which is an MVC framework, and use Backbone, you might be comfortable setting up your app in pure Node.js or Express.js, with additional modules for connecting to your choice of database.

With Express, if you plan to serve only JSON via RESTful interface, you don't even need to use Views, which is handy. You would only need to set up models and routes (that also serve as controllers).

Courante answered 20/6, 2012 at 16:10 Comment(0)
C
5

Any server side framework or lang that is capable of supporting or providing for RESTful APIs should work. I myself as using Slim PHP right now. But seeing that you are from a Django/Python background perhaps this post would be helpful to you.

Recommendations of Python REST (web services) framework?

Concurrence answered 20/6, 2012 at 13:49 Comment(0)
C
5

If you use Django, which is an MVC framework, and use Backbone, you might be comfortable setting up your app in pure Node.js or Express.js, with additional modules for connecting to your choice of database.

With Express, if you plan to serve only JSON via RESTful interface, you don't even need to use Views, which is handy. You would only need to set up models and routes (that also serve as controllers).

Courante answered 20/6, 2012 at 16:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.