Using Ember.js with DDP / Meteor backend - javascript

After past experience with Laravel and Backbone, I've recently gotten into contact with Ember.js and Meteor (for different projects). I really like Ember.js for its structured, route-based approach and for its open and forward-thinking community. On the other hand, I really like Meteor for its simplicity; how fast you can get something working.
There is one thing that I really love about Meteor, which is the DDP Protocol. The reason I ended up using Meteor for a project was because I wanted the best Websocket solution, and DDP's simple combination of RPC for client->server and PubSub for server->client is absolutely brilliant.
Would it be possible to connect Ember.js with a Meteor backend, and how would I go about doing this?

There's some work done for AngularJs: https://medium.com/#zfxuan/the-wonderful-duo-using-meteor-and-angularjs-together-4d603a4651bf
The best option that you have currently for Emberjs is to create your own solution.
I've a background in AngularJs but I don't like the idea of using AngularJs + Meteor. The same goes for Emberjs or any other frameworks that are redundant. By adding AngularJS/Ember/others you're increasing your project complexity. Meteor is great because every plays nice together but there is still a lot of work to be done by the MDG or by community packages.
You can simply use DDP in your application but then you're going to reinvent the wheel. Meteor already handles DDP, in-browser database (minimongo), the UI is reactive (Blaze), the auth system is integrated at the client and server, etc, etc, etc.
You can use 3rd party plugins with your Meteor app but trying to replace parts that Meteor already provides is the quickest way to have a really hard project to maintain. But, in the end, it's just my opinion on this topic and you should use whatever makes you happy.
Maybe you should consider sails.js: http://sailsjs.org/ it has support for SQL systems and probably serves best your purpose.

You can indeed connect other apps to a meteor backend without using meteor on the client.
Meteor has a full wiki page on different libraries. I think that is the most up to date source for information on libraries to connect to a DDP meteor backend.
A link to the JavaScript section: http://meteorpedia.com/read/DDP_Clients#JavaScript

Related

React with Server Side Rendering Stack

In the last few years, I’ve been working with an old fashioned stack, but pretty effective for my use case. The stack was Node + Express.js + Angular.js 1.x.
Basically, the backend made the rendering of the view (via dot.js or Handlebars, any template engine) and then, in the Frontend side, the Angular app was mounted.
The use case needed to be SEO friendly, so the content must be generated at the backend and served directly. Also, the UI has its functionality, forms, etc. It’s not just dummy text.
Currently for a new project with the same use case, I want to update my stack (using SSR aka server side rendering) where the app does not need to be a SPA (single web app). The base stack is still the same (Node + Express.js) and the only thing I want to update is the frontend library / framework.
I am looking for a framework / library with a big community and an easy way to share component and codebase across project. That’s why my first thought was React.
The first thing I found was Next.js and while I was reading and investigating, it goes beyond what I need. It is a quite big framework that has too much stuff I don’t need and I do not want to add overhead to my application and I cannot customize it as I desire.
I continue researching and I found an express package called "express-react-views" that is a template engine for express but it does not allow to mount the React application at the client side.
Browsing through the Github issues of the package, I found many people asking for these and they all end up being answered that Next.js was the way to go.
My doubts / concerns are the following:
Is React the right tool / library for this use case?
In case of not being, what do you recommend?
Being the right one, is there any package / tool on top of React and Express that helps me out with SSR that allows me the customization I need?
I don’t want to rely again in old or antique tools like jQuery or Angular.js 1.x because the maintenance and code sharing across projects is complex and annoying.
The easiest solution, without going deeply into Next.js, is using the native React feature ReactDOMServer:
https://reactjs.org/docs/react-dom-server.html#reference
It's actually pretty easy to use, you just serve the HTML as a string and mount your React App Client Side if you want then to handle requests with React Router.

Is Node.js suitable for my project given how I'm using it?

I'm about to start writing an application and I want to include newer technologies to improve my knowledge and gain a skill set.
I'm using mysql to store user data (no choice), Angular.js to display/template content on the dom, and I wanted to use node.js to return results from the database in json format to be used by Angular.js.
My assumption was I could use node.js (along with the node-mysql module and maybe express)to accomplish my database queries that feed into my Angular.js templates.
Additionally, the application will live on a different server than the database itself and may reside in a mobile framework.
Am I way off base when it come to how to use node.js? Am I just using the wrong tool? Am I on the right track?
Any help, explanation, and points in the right direction would be great. Most of the info I've seen are copy/paste from the node.js site/wiki and don't really answer my question.
This is largely an opinion-based question and likely to be closed, but you're not way off base. What you want to do is absolutely (and commonly) done using Node.js.
As a complete aside, you might like to check out Platform-as-a-Service providers such as Heroku.com and Nodejitsu.com; both offer great and easy Node.js hosting and addons (such as NoSQL and RDBMS data stores) which have free tiers.
For that matter, MongoLab and MongoHQ both offer free tiers independent of Heroku, which you could use from your MySQL-only hosting provider if you like.

Using Django for the backend only

At the moment I have a project where the backend is running in Flask + redis and the frontend is angularjs. The backend serves jsons and angularjs takes them to fill its templates.
Django has a bunch of features that I would be very interested in using (namely, admin and logging - I don't want to write that, it's boring). But Django also has a templating engine etc, it's the whole package.
I would like to know about the viability of using Django exclusively for the backend serving jsons (except admin, obviously). Is this a good idea, or does it have any obvious flaws?
Thanks.
It's perfectly viable to use Django for the back end for your site. I've done so myself with great success when I used it as the back end for a Phonegap app that used Backbone.
Tastypie is very good for creating an API - it's pretty easy to use, and consistent with the way Django works. I had a very good experience using it and can highly recommend it - it felt very similar to using Django's generic views. It also has excellent documentation, and can easily handle things like authentication for you.
There's also Django REST framework, but I haven't used this myself, so I can't tell you whether it's better or worse than Tastypie.
Regarding redis, if you want to use that for caching, Django doesn't include support for that out of the box, but the caching backends are made to be easily swappable and django-redis is available for using redis as a cache.

Is node.js + express (back-end) + emberjs (client) a reasonable stack for my project?

To preface; I'm an experienced web developer, though I have barely used nodejs, and have not yet had the opportunity to work with emberjs (though I've done a decent amount of work with backbone).
I'm about to start a project to build a web based writing application (literature). In theory, the user would potentially have the application open for long periods of time, perhaps leaving it on. I intend to develop an expanding functionality set over time, which I would like to be able to drop into different places with relative ease. For example, perhaps develop a character list which I could then include in many places. I'm keen on using emberjs for the experimentation alone, but it also sounds like a good client side framework for the job.
I've looked at django briefly (haven't used it much before), but given that I'd like to use emberjs, it seems like django isn't a great choice as I'd be opting not to use many of its most compelling features.
Would writing my server side code in nodejs + express be a reasonable choice? The web application itself will have common features like login, admin, different permissions for users/tasks (eventually) - but I also anticipate some more beefy stuff.
This is a solution that works well for my team and I so far. While lacking express, Charcoal is a good starter project to get up and running with Ember without a Rails asset pipeline and Express can easily be added as middleware. In addition to using Express to serve your JSON, it can handle the minimal HTML needed for such requirements that Ember can't fulfill by itself such as SEO since content negotiation capability is very simple in Express.

Where to store design documents for CouchDB?

I'm new to CouchDB and I wonder how experienced CouchDB handles the large amount of design documents.
My questions:
Where do you store design documents: In CouchDB with Futon's "save" or on harddrive then uploading it through the HTTP API?
If you are uploading them, how do you do it? You create custom queries or are you using any framework?
I'm using node.js, are there good libraries/frameworks that I could use to ease the CouchDB development?
Please share your experiences!
1) Since the whole of CouchDB works through a REST API, all Futon is doing really is working through the REST interface. Basically, you will always load it through the HTTP API. It's a matter of choice of which tool you will do it with, in which the tool abstracts the process for you. At the end of the day, all a design document is, is another type of document.
2) Personally, since I am coding for it in python, I use the couchdbkit framework, which has auto document loading on it. I am sure there is something similar for node.js. I am unable to answer though.
3) Maybe node-couchdb, although it seems to be no longer maintained. There is alot of material on the internet, just google it!
CouchApp is the best tool for managing/uploading your design docs. Its main purpose is for pure Couch apps but you dont have to use that aspect, it makes design doc managing a breeze (couchapp push).
CouchDB is JSON over HTTP, both things Node does more or less natively. I've found the npm module Nano to work fairly well.
As far as CouchApp goes, there's a couchapp for node.

Categories

Resources