Meteor API vs external API - meteor

Basically I want a real time application (Meteor) so I can see a real time dashboard
This back-end (Meteor server) would eventually be hit by some external application via API to get data from the DB (example: mobile App) or add some entries (not from the front-end)
My question is : What is better: create a Meteor API OR create an external server (ExpressJS) that would be connected to Meteor DB?

Meteor is great for building Full Stack apps (front end + back end), and has native support for MongoDB, which together are powerful for building real-time apps (using DDP for example) relatively easily.
Express is an MVC Framework built in Javascript and powered by Node. You will usually have to consider more technologies and frameworks when using Express (MEAN stack), which has a steeper learning curve when compared with Meteor.
Given that you're intending to develop a Full Stack app, building an API using Meteor is more straightforward. As suggested by Mikkel, restivus would be the Meteor package to consider for building your REST service.
If complexity is not a hurdle, using Express is likely to yield to a more efficient solution.

You can integrate express with Meteor - probably a better solution, because you only need one server.
There are Meteor packages for creating REST API's that work well https://atmospherejs.com/nimble
Another approach (my preference) would be to use GraphQL server with Meteor. Apollo Client and Server were developed by the Meteor Development Group (MDG) https://github.com/abhiaiyer91/sample-graphql-meteor-server

Related

Can a MeteorJS app be instrumented for OpenTelemetry

I'm not familiar with MeteorJS other than it's a framework whose underlying language is Node.js. Having said that, can you instrument an app in MeteorJS for OpenTelemetry?
Unfortunately at the moment there is no auto-instrumentation for MeteorJS, but you can still use OpenTelemetry to instrument your app manually.
To do the manual instrumentation you can follow this guide:
https://opentelemetry.io/docs/instrumentation/js/instrumentation/
And in this registry you can find the list of supported frameworks (which can be used with the auto-instrumentation):
https://opentelemetry.io/registry/?language=js&component=instrumentation

Meteor mobile build vs having a phonegap browser

Why is the difference between using a simple phonegap browser app pointed at your site vs using meteor's mobile build options?
a simple phonegap browser app pointed at your site
Not sure exactly why you would be ready to use this option, compared to a simple shortcut / link to your site, or even an "installable" Web App.
Anyway, since you point at your site, it means you require an Internet connection whenever you open your app, and you are limited by what a website can access to on your device.
meteor's mobile build options
It becomes similar to a native app (it is actually called a "hybrid" app), so you can use it totally offline, and you can access more device functionalities (file system, notifications, etc.).
Nothing really specific to Meteor here, it is rather why using a hybrid app v.s. a shortcut.
In the end, you should base your decision on your requirements:
Do you need to access your app while offline?
Is your app primary functionality accessing "real time" content that makes no sense using your app while offline? (like news, forums, etc.)
Do you need to access specific device functionalities, that are not accessible by a normal website?
You should have plenty resources on that topic on the Internet.
Your question might rather be: what is the difference between a standard hybrid app (typically built through Cordova / Phonegap) and one built through Meteor?
In that case, you are asking what Meteor brings specifically? (as it uses Cordova under the hood to build the app)
First of all, you have all advantages of Meteor framework for normal website (minimongo, isomorphic methods, etc.)
You also have by default the Hot Code Push functionality. You can also set it up on your Cordova / Phonegap app, but you will have to configure it yourself, whereas Meteor does everything for you.
Finally, you might benefit from Meteor packages that bring Cordova plugin + client code + server code, something unique to Meteor as it is a full-stack framework.

Does Sails.js or Meteor.js work with ArangoDB or OrientDB?

I'm planning to work on a social site and I would like to leverage both a document and graph database for all of the desired features. Is there a way to get Meteor.js or Sail.js (or any better) to work with ArangoDB or OrientDB? Or should I just stick with the bundled MongoDB and integrate something like allegrograph DB?
Sails.js has support for both of the databases you mention:
https://www.npmjs.com/package/sails-orientdb
https://github.com/rosmo/sails-arangodb
In addition to MongoDB, Postgres, and dozens of others.
Sails.js is a classic mvc client-server web application framwork, basically its ruby on rails implemented for node.js + webscockets, so mostly all you need to make it work with any backend database is make changes to the orm.
Meteor is a very different beast, it is a very opinionated realtime end to end web framework including client server and database, by behing very very opinionated it solves many of the common issues in realtime application, where you need to implement a mechanisms for very quickly updating all your clients of each others actions and take care of things like latency compensation, data collision resolution, and real time client version managment, This is implemented by using web sockets and the mongoDB's write ahead logging for triggres of data updates, making meteor somewhat coupled with mongo.
But you can make orientdb work pretty well with meteor using the new orientDB live query api. It is a pubsub implementation for query results, and can be used for efficent updates pushed from the db through the server directly to the client with very little overhead on the server. This is far from production ready and only currently works on the orient db 2.1 rc5 version.
I have implemented a small meteor demo application as an example https://github.com/imdark/meteor-orientdb-demo
Please check on Meteorpedia the Alternative Database Post, they mention neo4j-livedata and minineo4j.
Here is the Atmosphere package: ostrio:neo4jdriver
Is there a specific economic or technological reason why you consider not to use the very well integrated mongoDB as the database of choice?
In addition to Travis answer I also recommend waterline-orientdb for Sails.js.

Meteor REST driver

Is it possible for Meteor to use RESTful db driver instead of Mongodb?
I have started studying Meteor and I want to use it in a project I am working on. The problem is that this project uses MySQL. I want to keep using Mondb syntax for CRUD operations but instead of using the Mongodb database I want to use RESTful for a PHP web service.
For example, when I do: Albums.find({'name': 'Atom heart mother'}) I want Meteor makes a GET request to http://server/web_service.php/albums/?query={'name': 'Atom heart mother'}
I don't care if Meteor is still using mondodb for the session, app state and some other stuff.
Thank you people, and sorry if my english sucks
For the moment, Meteor can't be used with SQL directly - the best try at this so far is the meteor-sql smart package, but it's been inactive for a good while. And the meteor roadmap doesn't make SQL integration a priority.
The meteor iron-router does allow server-side routing, so you could potentially link your Mongo calls to server routes this way... but wiring this up to Meteor's real-time data might be tricky.

Combine Meteor and Express

I am evaluating Meteor as an alternative to developing real-time capabilities using socket.io and it looks like awesome framework for single page real-time apps. It is great time saver that enables developer focusing on the business logic of the app, rather than writing boilerplate code. However, I find it still pre-mature for a medium size app with multiple pages/routings and REST api. Plus, number of features like i18n are still not available which requires some time investment to develop by myself.
I think that it would be great if I could combine Meteor and Express and use Meteor in use cases where it really shines.
Is it possible to develop an app using standard Express/Mongo stack and use Meteor for only specific part of the app where I need real time collaboration?
For example, can I share a session between Express/Connect and Meteor?
Thanks!
This does not directly answer your question, but I thought I'd throw it out there:
You should check out the community packages on atmosphere. Specifically, I'd recommend having a look at iron-router and i18n (I'll note I have not used the latter).
I've built a large production app that uses iron-router and it's running smoothly. You may also be able to use its server-side-routing capabilities to implement your REST api.

Resources