4

i am learning all the technologies necessary to build a Single Page Applications (SPA’s). As a summary, i want to implement my app as separate layers, where front-end only communicate with back-end using API web services (json through socket.io). Front-end will be basically Backbone.js (+ html5, css3, jquery), and back-end using node.js (+ mongodb, express, etc.). The decission of using node is because of socket.io.

My questions maybe sounds pretty basic, but i still don't get it.

  1. on this configuration, is it necessary to use Express.js? as far as i know, the main features of Express.js are offering Web API and serving web pages through routing. But since i want to build up a entire front-end with Backbone.js as a SPA, and serving CRUD through Socket.io, is Express.js necessary on my project?

  2. on this configuration, the node sever would just listens for socket.io crud commands, right? in here, there is no need to use Express.js as rest api server, right?

  3. If i only want Web API and real time CRUD multicast operations ( like you can do with Socket.io), is it a must using Node.js as a back-end, or i could use another technology?

i hope someone could enlight me with some answers, and thank you very much in advance for your time and support.

FOR EDITORS: since months i am having some big issues with accepted answers. I always accept them, but stackoverflow always shows that i don't. I really would appreciate if some stackoverflow editor could help me with this issue.

1
  • 1
    In short, answer to the first two questions are 'Yes' and the last one 'No. Check the wiki github.com/LearnBoost/socket.io/wiki for complete details Commented Feb 1, 2013 at 10:01

1 Answer 1

3

on this configuration, is it necessary to use Express.js?

No. The only requirement for socket.io is a listening http.Server.

on this configuration, the node sever would just listens for socket.io crud commands, right?

Possibly. You still need to be able to serve up any (static) files necessary for the SPA to begin making WebSocket requests.

[...] is it a must using Node.js as a back-end, or i could use another technology?

Not necessarily. The socket.io library does require Node.js. But, if you just need the functionality of it, there are other options listed under "In other languages."

Sign up to request clarification or add additional context in comments.

4 Comments

Hi Jonathan,thank you very much for your answers.I think i have a big conceptual issue here, and i would appreciate if you could clear it up.If i don't want Node.js to serve up static files like html,css and javascript (like it should be done using a traditional Express.js app), because i want it totally independant from back-end, who should serve my static content? i mean, my SAP content.thank you very much in advance
@MichaelTrend You'll want a static server. That can be the same http.Server you're using for socket.io or any other server system -- nginx, apache, etc. WebSockets do support cross-origin connections.
Hi Jonathan Lonowski, any advice from your personal perspective if what i want is to build up a SPA? serving html+css+javascript through http.server() or through gninx?
@MichaelTrend Either should work, but there's no "one size fits all" and, of course, I can't really tell you what's best for you. :) You're going to have to just try one or the other and see if you like it.

Your Answer

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.