最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Real Time API backend and frontend - Stack Overflow

programmeradmin2浏览0评论

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 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'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

Share Improve this question asked Jun 22, 2018 at 6:07 Ext-Ext- 5413 gold badges9 silver badges16 bronze badges 3
  • it is very much possible. in your front end put an event emitter to App and Mount it, whenever a response es handle it – pr0p Commented Jun 22, 2018 at 6:13
  • use Socket-IO : socket.io and npmjs./package/socket.io-client – Saurabh Mistry Commented Jun 22, 2018 at 6:13
  • thanks for the ments :) I just want this to be of value, and applicable. I just installed socket.io with npm. I just want to know if I'll be able to make the backed, rather than using an already created backend (like coinAPI). I guess I could use coinAPI's API to submit stuff to my mongoDB server every 20 seconds or something? (erm.. well I guess I would do every 20 minutes considering coinAPI needs a subscription for more than 100 requests. but yeah..) – Ext- Commented Jun 22, 2018 at 6:36
Add a ment  | 

1 Answer 1

Reset to default 5

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./watch?v=tHbCkikFfDE

And here is one with MongoDB: https://www.youtube./watch?v=8Y6mWhcdSUM

发布评论

评论列表(0)

  1. 暂无评论