Symfony2 + NodeJS + AngularJS? - javascript

I want to start the development of an real time and single-page application with authentification, actions, and notifications.
Is it possible to make the back-end treatment with Symfony whom I know well, and to add NodeJS / AngularJS by above?
This plan will help you has to understand me. Is it possible to apply it, and is it a good practice?

First, I believe we need to clarify some misunderstandings regarding the real time and AngularJS. AngularJS $http and $resource use Ajax in the background.
To have real time communication where the server pushes information to the client (instead of responding to Ajax calls), you would have to use Websockets. There are several alternatives in this domain, for example, socket.io integrates very well with nodejs, Ratchet socketo.me is specific for PHP, or you can use a 3rd party like Pusher through github.com/pusher/pusher-angular.
Second, you can certainly invoke PHP scripts from nodejs, however, unless you have a very specific reason to do so, it seems to me that it defeats the purpose of using nodejs. If you do not have such a requirement on use nodejs.

Of course yes.You can have nodejs and symfony2 in your server.you can use nodejs inside Symfony2 using CLI method.in front-end you can use angular and nodejs (converted).There is nodejs package,which lets you to convert your nodejs code to browser(browserify) side code and you can use it with angularjs.NodeJs has a package called socket.io.You can use it to have biDirectinal connection between server and client.

Related

What's websockets and what js framework should I use

I'm very new to the Java Script world , I use Laravel already for my backend but when it came to the websockets part I kinda got messy , because when I looked for websockets I have read that they all are depending on Node JS for real time apps like chat apps but also I have seen a tutorial making a chat app in Vue Js & laravel echo only without using node js ,
now the messy part for me is , If I want to learn socket.io (for example) should I learn Node Js first ? And is Vue js an alternative for the socketio ?
and How about the ajax ? isn't it able to do the same performance ?
I'm sorry but It's kinda messy for me , I have looked for that but it is still messy for me , thanks for advance
If I want to learn socket.io (for example) should I learn Node Js first?
Yes. Since Socket.IO is a Node.js package, it's kind of a pre-requisite to learn Node. It's one of the easiest tools to learn though, so don't be intimidated.
And is Vue js an alternative for the socketio?
No. Vue.js is front-end framework, which means it's used to build the part of the website you actually see. Socket.io is a package (or framework) that enables bi-directional communication between the front-end and the back-end of your application. You can use it for example to build a chat application.
How about the ajax ? isn't it able to do the same performance?
No. Ajax is short for Asynchronous JavaScript And XML. Which basically means that you use Ajax requests from the front-end to the back-end. The difference here is that Websockets/Socket.IO gives you the bi-directional communication that Ajax lacks. You don't need Socket.IO for all communication though
I agree with everything exposed in the accepted answer except that Vuejs isn't an alternative. It is true that vuejs is a javascript framework to create frontends, but, if you have a nodejs server with a socketio server, you need a client (frontend) which must be able to communicate through socketio. You can see this by yourself here, this is one of the most common vue wrappers library to use socketio from vuejs. I hope this could help

Integrating React.js non JS Server API

I will soon be starting a new project which involves upgrading my existing application frontend to use React.js. The current frontend makes standard REST calls to a server built using Microsoft technologies, which is not planning on changing any time soon.
I want to utilise the concept of server-side rendering and the new React Saga framework to improve SEO and performance. As I understand, in order to achieve this, I would need to run a Node.js server to enable this behaviour and make server-to-server calls from Node.js to the existing API.
My question is.. is this a common architecture? I.e having Node.js act as a middleman server? (UI - Node - Existing API). Or is there a better way/technique of integrating exiting non-JS APIs with the latest and greatest UI frameworks?
Any resources/materials you can provide for some reading on this topic would be a great help too!
Thanks.
Yes, its common and its also not bad, to split it that way:
Frontend Server
API(s)
The FE-Server will render and serve the UI.
The API(s) could be further splitted in many smaller microservices.

Is it possible to have backend written in Haskell and frontend with Javascript?

currently I'm working on this project (https://github.com/Giegling/addressbook) and for the backend I use Node.js with Express framework, for the frontend Angularjs. Is it possible to "translate" the backend to Haskell without touching the frontend? If it's possible, which framework should I use? (Yesod, scotty...)
Thanks
Your server simply exposes a HTTP API to your angular app. You can implement that functionality in any web framework (or even without a framework) in pretty much any language.
Yesod is probably the most popular and well documented Haskell framework (personal opinion), so I guess you can start with that.

Ionic Framework / .NET application sync?

I want to create a Android application (using Cordova/PhoneGap Ionic Framework, which means it's source code will be JavaScript + HTML + CSS and AngularJS as well. I need that app to sync to a cloud database service, but, I also have a .NET based project, which need to sync to the same database. I wanted to use like a Firebase-ish backend, that could manage all the database stuff, as I wrote only (at least mostly) front-end code for my app. Keeping in mind that I need a NoSQL database service.
To give an example:
I want my app to communicate with, let's say, CouchDB (IrisCouch on the cloud to be specific), and my .NET project to listen to the changes my app makes to the database, and handle them. What I need is a platform where I only need to call API's functions, or the closest I can get to that. I tried Firebase already, but that will get too expensive, as I need something cheaper, at least for now. Am I expecting too much? Do I really need to write server-side code in this case, and if so, which would you guys think it's the best way?
For back-end you can use ASP.NET Web-API which supports ASP.NET Identity with OAuth login like Facebook, Twitter etc. and on front-end you can you use IonicFramework with AngularJs to call those API.
Helpful resources:
ASP.NET
IonicFramework
AngularJS
Restangular (Restful operations made easy for angular)

CouchDB AJAX interaction

I'm writing a CouchDB sample. My intention is to write a web app using AJAX and deploy it in the tomcat environment. As I use the CouchDB I would like to know the way to interact with the CouchDB server. However there were few examples but I have few concerns over that.
1) As my application is deployed in a web server is it possible to connect with a CouchDB outside? Many examples uses apps which are deployed in CouchApp or Couch environment itself.
2) If so will it end up with cross domain issues. I found this in here
Connection AJAX, CouchDB and JavaScript
However will this be a problem? Is this the correct way to achieve this?
3) To omit above issues is it possible to use some server side javascript implementation as an example Rhino?
http://www.mozilla.org/rhino/doc.html
4) If I use Rhino above it wont allow many java script libraries to use. How do I interact with CouchDB then? Do I have to invoke native Javascript? Cant I use something like JQuery?
5) What are the best libraries for client side to achieve my goal?
Your help is appreciated.
Thank you
Based on your need to use tomcat, I would just recommend using ektorp (http://ektorp.org/). Just think of ektorp like a jdbc driver. No need to do ajax from the user interface, or no need to use javascript from java in your server.
Ektorp also lets you annotate your java classes with the javascript couchdb needs to make views. see the example here: http://ektorp.org/reference_documentation.html#d100e753
Hope that helps.

Categories