Is there a way to use ShareDB with AWS API Gateway WebSocket? - node.js

I'm developing a collaborative text editor, and the great ShareDB library was the best option I can find, very simple to use and accessible!
But now I'm figuring out where and how can I host a scalable backend handling ShareDB.
In the beginning, I was thinking of AWS Elastic Beanstalk, but I have some trouble making the WebSockets working on it. And then I discover AWS API Gateway Websocket, which seems to be very versatile and useful for what I am searching for.
I was wondering if some of you ever tried to make these two interesting technologies work together?
Thanks a lot for your answers :)

Related

Nodejs, RabbitMQ and RestAPI

I have been breaking my head over this for over 2 weeks now and I don't seem to understand if what I'm doing is considered right or good practice. So I have been trying to implement a simple todolist of sorts with 2 services, the task service and the user service. I have created a few AMQP connections by reading through the documentation and was able to implement a request/reply pattern. What I don't get is, Am i doing this the right way? or is there a better way to do this? I'm pretty new to rabbitMQ and have plans of using this in my upcoming project with microservices. I understand the concept behind it but the implementation aspects of it seem bleak and I'm tired of going through very simple demo explanations.
Heres the application. Hope I get some help with this.
RabbitMQ and Nodejs with RestAPI
I have posted it in rabbitmq groups but I have no luck yet. Any help will be nice.

Node.js API & webpages with NGINX and AWS best practices

For a project i have to create website showing data from a database with data that changes frequently (sensor data: temperaturen, humidity,...). This by making an API to get the data. I created a REST api in Node.js to do this.
So Database -> API -> WEBSITE
What would be the best way to create the Dynamic website and what is the best practice to get the API to the outside using AWS? And in this solution, is it usefull to use NGINX in any way?
Other suggestions and literature about the subject are also welcome.
To create the dynamic site i would say use angular JS/Angular2 which provides you the capability of two way data binding and make life easy to implement the website in quick period of time. For REST API you have used NODEJS which you can host to AWS and provide a reverse proxy viz; NGINX. the use of reverse proxy is useful in case of high traffic sites;which also protects the NodeJS server from direct exposure to Internet traffic and allows you a great deal of flexibility in using multiple application servers, in load balancing across the servers, and in caching content. So if you think your app is having heavy traffic you can use NGINX
So technology stack for you can be something like MEAN (MongoDB -if you also need to choose db; ExpressJs,NODEJS and ANGULAR) which hosted on AWS EC2 server.
Apart from this in case you dont want to maintain server you can also think of serverless architecture on aws (with lamda). Hope my answer will give you good pointers further.

Easiest server and database services available for deploying an application (AWS specifically)

I have written a real-time multiplayer game and currently writing its server in NodeJS. I want my game to have login, level up etc, so I need to have a database. This is the first time I am deploying something and I am mostly self taught, so please correct me if I am mixing things up. Since this is my first trial, I do not want to make much commitment right away so I am looking for free options only. And since this should be a real-time game, I need a relatively fast server response. That is why I am looking for the easiest database and server provider that would do and I am aware that with those restrictions I have limited choices and functionality.
As far as I have read online, Heroku seems to be my simplest option for a server (that is why I started writing in NodeJS). However it seems like there is no free database service since all options on https://devcenter.heroku.com/articles/heroku-postgres-plans has monthly fee. I did not want to use Google App Engine since I am new (it certainly is not mentioned as beginner friendly).
So I have found AWS following Free Cloud Database Service for home development post, it seems like I could use Amazon Web Services as a server and database. However most posts I have encountered suggests Google App Engine or Heroku with little mention of AWS. Is this because I am mixing concepts up, or does AWS have drawbacks that I am not aware of? Do you think it is a good idea to use AWS for both as server and database, is it possible to use Heroku as server while using AWS as database or do you have any other suggestion?
Note: Sorry for the question bombardment but those are all related and I am sort of lost in this topic so I had to ask...
Use AWS EC2 for the server and RDS for the database. The reason why people use heroku is that it deploys to a custom url very quickly (it's easy to set up). Setting up AWS requires some knowledge of how servers work, but it's not that complicated (and it's free for small apps). Best of luck!

derbyjs for REST API

First of all, I have seen this question: How to best create a RESTful API in Node.js and it has pointed me towards mers, which has been a great help.
But I have also been reading a lot of good things about derbyjs and it does look really interesting.
So my questions, does it make sense to use derbyjs for ceating a REST API (real-time features might be useful in the future, but not a 100% certain at this pont.)? And is it any better or worse than mers?
I am really grateful for any help.
Edit:
If anyone is interested, decided now to use sails.js: http://sailsjs.org/
The strength of Derby is that the same views (i.e. rendering templates into HTML) can be executed on the client as well as on the server. So for building a webapp, you won't have to explicitly code a REST API and then use it from the client-side JavaScript, instead you just write your views and Derby does the rest.
So if you're looking into making a REST API only (as your question states) and no HTML, there is no advantage in using Derby. It's the wrong tool for the job.
It depends on what you're looking for exactly. Derby.js is built on top of Express.js which has excellent support for creating a REST API. This also means that anything you can do in Express, you could also do in Derby. If you want real-time features, and the ability to build out a REST API, Derby.js is an excellent choice. It's also one of the reasons that people recommend Derby over something like Meteor (currently Meteor does not have support for REST endpoints, but it will hopefully in the future so also something you might want to keep your eye on, if you're in the market for real-time framework). However, if you're not looking for a node framework with an emphasis on real-time functionality, Derby is not the right choice. I would however recommend looking into Express.js to build a REST API. We use it currently for that purpose and it works really well. There are also a number of libraries and packages that play nicely with Express, so in the future if your needs change, it's easy to find something that works well with Express.
Anyway, I would recommend checking out some basic tutorials for how to create a REST API in Express because once you're able to successfully do that, adding some of the real-time features of Derby.js is fairly straightforward.
Basic tutorial on creating a REST API in Express.
http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/

Recommendations for Cloud Hosting Service for Socket.io

I'm currently evaluating the different cloud service providers to determine which is best for the use of NodeJS backend with Socket.IO implementation that is speedy. While i know that is really dependent on the physical location of their servers, i hope there is one in south-east asia.
I've already deployed on the following:
Amazon EC2
Heroku
Appfog (doesnt seem like it works on it)
Any other good ones to recommend? Would be good if they have a free tier much like how AWS works.
Look forward to your opinions!
Note that at this time Heroku does not support web sockets, so any use of socket.io will have to degrade to a long-polling approach.
With your use of Socket.io in mind, I would recommend using Amazon EC2. The main advantage of many other hosting options in the past has been their easy of deployment and management of all your resources (think Heroku). Amazon has recently launched OpsWorks, which you can use to take care of most of that for you. If you don't have any complex, custom requirements then the basic Node set up should work for you.
Keep in mind that if you are using OpsWorks there are a few small things to keep in mind. Some of them are discussed in this question. Has anyone been successful deploying a node (express) app with Amazon OpsWorks?
#Nick Mitchinson gave an amazing answer. Also you can have a look into the Elastic beanstalk. AWS recently released Paas version of Nodejs.
Websocket is now supported on Heroku by the way.

Resources