Real Time API backend and frontend - javascript

I'm starting a project to create a front end and back end API that updates in real time.
I was thinking of making something like a Forex "viewer" of sorts using https://www.coinapi.io my only problem is, I want to make the server and everything and have it fetch data from that api, put it in my own DB, and have the frontend update in real time (i.e. a price drops, and it instantly updates without really a refresh).
I'm wondering if something like this is practical. I think its a great idea and I'm super interested in this.
I guess I would use websockets, but I don't know the first thing about that, my experience is with REST API's.
Any ideas/thoughts would be nice.
The frameworks and resources ill be using are:
Bootstrap
Vue.Js
Chart.Js
Node.Js
Express
CoinAPI
MongoDB
Mongoose

I think Express and Socket.io would be a good solution here. They work really well together and you would have crossbrowser checks and a lot of stuff you get with Socket.io out of the box. If you would use your own WebSockets you would have to write all this stuff, which is also a good thing if you know what you are doing.
It can work really well and fast, of course it always depends how well you write your code. But the idea will work fine.
Here you have a beginner friendly tutorial for socket.io:
https://www.youtube.com/watch?v=tHbCkikFfDE
And here is one with MongoDB: https://www.youtube.com/watch?v=8Y6mWhcdSUM

Related

how to update a value direct once its change(client side)?

For example: i've changed "user balance" in my database, how to update this value direct on client side. So my client in this case see that change immediately.
I don't like to do it with jQuery since it will be slow with required speed and will makes some performance troubles.
a website called blockchain.info does that somehow, maybe he is using websocket.
BTW I tried to use Ratchet webSocket but I don't know how to link each connection to specific client.
Any help would be appreciated, ask me if you have any questions.
If it is a new project, try using the meteor framework, but I don't know if such a drastic change makes sense for the size or stage of your project or the criticality of your requirement. Meteor is very good for "subscribing" to changes in data and updating the view based on that. In fact, it is very trivial in meteor. However, moving your entire application to meteor may not make sense, only you can decide. Check out https://www.meteor.com/
I commend your dedication to efficiency. Maybe take a look at this site to see if thats what you're looking for.
AJAX with Vanilla JavaScript

Frameworks javascript faster angular meteor react

I need to make a webApp with a good framework.
Actually i have been working with angular and i think that it can be not enought to my app because it is going to have a lot of work in the part of the client so i have thought in react.js or meteor.js.
Finally, i think that i am going to use meteor.js because it can make in the server and make the client to be with less work, but i want more opinions about it to decide what framework use.
In my app i will need to create a scenary with objects where the user is going to be able to move that objects in the scenary, so it can be a lot of work for the client.
Their all good frameworks and will have their ups and downs whatever you're building. I would suggest to use the framework you're most comfortable with.
This may help to choose: http://todomvc.com/

What are the first steps in building a Node.js development

I am a mostly front end JavaScript developer looking to get more into server side development with Node.js. My current level of understanding of Node is decent, ie. I understand what it is, how to install, and basics of getting it running. What I am interested with now is help / advice on what what to do next in order to get larger applications built. What are best practices / frameworks for getting an HTTP server up and running to serve my front end code (HTML, CSS, and JS). I know that there are things like soket.io once you have the app running for communication with the server but it is the first step I am interested in. Also what are best practice for organizing code on the server (separating out front end and back end files on the server). I would also be interested in any advice on getting a database setup and interfacing with it. I think for now I will wait for anything to do with deploying but eventually I will be looking into that.
I know this is a lot and I'm not looking for anyone to answer all this just some help getting pointed in the right direction for the point that I am at right now. I am also not apposed to paying for an material (as long as it is not crazy expensive) so if you have written any books you think that would help someone at my level please point me to it. As always a huge thanks to anyone who thinks they can help me out.
I would recommend you the Express JS framework. It's easy, powerful, and has awesome documentation.
I would definitely use express.js and mongoose to connect to mongodb to save data. I would not start with socketios until you clearly understand how nodejs and its callback mechanisms work. It gets complex and confusing if you do not understand that properly.
Checkout this post.
Looking for a reference nodejs, expressjs & mongodb app to use as template
If you're new to server-side development, I would suggest you start with one of the web frameworks, something such as express.
I would also recommend Underscore.js for writing cleaner more concise JavaScript. If you're planning a frontend of any significant complexity I would throw in Backbone.js to help structure the application. And if you're not sure about server side templating I have had a very positive experience with Jade.

can batman.js be used with express?

I'm currently using Backbone.js for my webapp but I just read about batman.js and I like the features it has to offer. However, I want to know if it integrates with express or am I stuck with the batman server.
I spent a day putting together a boilerplate application, because I wanted to do the same thing, and it didn't seem very clear how to get started. Batman-Express
Batman will work with any server so will be fine with Express. In fact I've read that the seerver side of Batman isn't ready yet so you'd need to use it with something else on the sever for the time being anyway

Decision about web application architecture

I am facing a decision about the web application architecture I am going to work on.
We are a small team and actually I will work on it alone (everybody work on something else).
This application will consist of front-end build on the ExtJS library
and it will use the model "load page, build GUI and never refresh".
On the web "desktop" there will be a lot of data windows, map views (using openlayers + GeoExt) and other stuff.
GUI should be flexible and allow every user to modify (and persist) the layout to fit his/her needs.
It should be possible to divide the application into modules / parts / ... and then let users in specific groups use only the specific modules. In other words, each group of users
can have different GUI available on the web "desktop".
Questions are:
First of all, is this approach good?
There will be a lot of AJAX calls from clients,
may be this could be a problem.
How to handle code complexity on client side?
So far I have decided to use dojo.require / dojo.provide feature and divide the client side code into modules
(for production they will be put together using dojo build system)
I am thinking about to use kind of IoC container on client side, but not sure which one yet.
It is very likely that I will write one for myself, it should not be difficult in dynamic language like JavaScript.
How to handle AJAX calls on server ?
Should I use WCF on server side ? Or just ordinary ashx handler ?
How to handle code complexity on server side ?
I want to use Spring.NET. May be this approach could help with modularity problem.
Data access - here I am pretty sure what to use:
For DAL classes I will use nHibernate. Then I compose them with business classes using Spring.NET.
I would really appreciate some advice about which way to go.
I know about a lot of technologies, but I have used only little part of it.
I don't have time to explore all of them and be fine with the decision.
We do this type of single page interface where I work on a pretty large scale for our clients. (Our site is not an internet site)
This seems to work pretty well for us. The more js you have the more difficult it gets to maintain, so have as many automated js tests as you can and try to break up your js logic in an mvc fashion. 4.0 is supposed to make this much easier.
Ext 4.0 has this built in if you are trying to limit the code you bring down. If you have the same users day after day, then I think it would be best to just bring all the source down (compressed and minified) and cache it.
We've found asmx to work really well. I have nothing against wcf, but last I looked it seemed like more trouble than it was worth. I know they have made many improvements recently. asmx just works though (with a few request header changes and managing the "d." on the client side).
Our Server side data access layer is pretty complex, but the interface for the ajax calls is pretty simple. You have not really given enough info to answer this part. I would start as simple as possible and refactor often.
We are also using nHibernate. Works fine for us. We have built a DDD model around it. It can take a lot of work to get that right though (not sure if we have it right after months of working at it).
If I were you I'd start with just extjs, your web service technology, and nHibernte.
I would recommend ASP.NET MVC 3 with Razor instead of a lot Javascript and calls to Service you can just do ajax calls to an Action in a Controller and that will let you have more maintainable code and use a IoC like Ninject. EF instead of NHibernate.
But it's your decision.
I would look into using a tool like Google Closure Compiler, especially if you're dealing with a very large project. I don't have too much experience with ExtJS, but large projects in JavaScript are hard and something like Closure Compiler tends to make it easier.

Categories