All the meteor samples I've seen have been mongo based. How do I plug another data source into meteor, eg my own custom REST API?
Well, REST has nothing to do with the type of database you using (relational, or something else, like Mongo). You can implement a REST api while using Mongo.
According to this SO answer (couldn't find it in the docs though):
You can substitute another database for MongoDB by providing a
server-side database driver and/or a client-side cache that implements
an alternative API.
I am guessing this is probably not the route you would like to go. That being said, if you are interested in building out a REST api with Mongo you can look on the atmosphere site for helpful packages. Example: Collection-API
Related
Most of "bigger" project I was working with was using REST API for Frontend->Backend communication. I was using Firebase Cloud Firestore for some small (one-day/hackathon) projects. Now I'm thinking about using Firestore for some bigger project but I'm not sure if this will work.
For "standard", REST api project I had Swagger documentation, where each developer could see list of all endpoints with request/response data structures. How does it work with Firestore? Can I create similar documentation for developers to check data structure, so they will know what can they add and what should they read? Or maybe there is another way?
I'm thinking, maybe there is no tool for this kind of documentation because frontend data structures are defining database structure? But what if I am connecting database from two or more platform (ex. web, mobile and cloud functions)? How can I synchronize knowledge about data structures between all the developers?
I was looking for some answers but couldn't find anything useful expect advice to manually maintain some documentation. How does it work in your projects? Is there some automation? Manually written documentation? Or no documentation - everything "in code"?
I understand your concerns, but unfortunately, there is no such tool available for Cloud Firestore to generate the documentation for database structure as Swagger.
I believe you can do it programatically.
From
Generating Swagger Docs in Firebase Cloud Functions project
I'm using express and nodejs in my Firebase Function implementations, and for me, Swagger doc generation can be implemented via the following libraries:.
https://github.com/scottie1984/swagger-ui-express
https://github.com/Surnet/swagger-jsdoc
You can find other libraries at:
https://swagger.io/tools/open-source/open-source-integrations
In addition to the responses there, the following service allows you to access Firestore metadata, click the explorer tab, looks promising for your use case https://aapi.io/api-directory/Google_CloudFirestore_GoogleCloudFirestoreAPI_v1beta1 though not necessarily more so than the links above.
I have two production apps that are currently using Parse.com. I have no plans on using Parse server, and I wanted to switch to the firebase service. I was wondering if there was a way to migrate my database from Parse.com to Firebase
There are differences between Parse and Firebase that makes a straight migration not as easy as you would hope.
Parse is based on a relational database, where as Firebase stores all it's data in JSON - thus a "copy and paste" job isn't going to work here.
On top of that the way that the two platforms organise user authentication is completely different.
So unfortunately no easy solution here.
Firebase has a import JSON option so if you get your data out of Parse.com as JSON, it can be imported.
However, the structure Parse uses to create relationships between data is (probably) going to be different than Firebase, so it's going to take some planning and coding to make the transition.
Once we had a plan, we found it easiest to just craft an importer App that would take the Parse.com data structure, and massage it to a Firebase format that worked for our app.
In some cases we had to start from scratch as the thought process is different from Parse (objects) to Firebase.
Firebase API is completely different from the Parse one. It means that you have to learn other API, SDKs, etc, and rewrite your frontend code.
Does not exist an easy path to migrate from Parse to Firebase.
Moreover I think it is not a good decision. Parse Server community is growing and it is becoming even better than original Parse. In a short time, Parse Server will become the best framework for backend and API development.
My recommendation to you is to migrate to a Parse Hosting provider. Using this kind of solution you will use same Parse APIs and features. It will not require you learn other technology nor rewrite any frontend code.
You can find some options in parse server repository:
https://github.com/ParsePlatform/parse-server#parse-server-sample-application
For a full disclaimer, I am co-founder of https://www.back4app.com that is the first parse server mover.
I have recently started using Telescope (http://www.telesc.pe/) from the creators of Meteor for a small project. I am just starting to learn about Meteor, and since essentially database / web server and application stack are collapsed into one framework, I'm wondering what the most efficient way is for me to have an external application (for ex: python script) post and access posts/comments from Telescope. Essentially, I'd like a bot to be able to:
Create posts
Add comments to posts
Pull back a list of posts
Ideally I'd like to access this via HTTP requests (get/post/etc), but am not sure how to do this within telescope / meteor or possibly DB queries. Any help (such as an example API call to create a new post) or the appropriate way to do this using Meteor would be much appreciated!
From the documentation it doesn't look like Telescope has a webservice API and there aren't any plans for it on the roadmap either.
Luckily meteor has a packaging system, which telescope already uses a lot.
So you could make a meteor package that hooks into telescope and exposes webservices for the functionality you described.
Meteorpedia has a good article on how to create rest api's in meteor: here
Telescope has a basic API. You can see a sample response here...
http://meta.telesc.pe/api
And here's the package that makes that happen.
https://github.com/TelescopeJS/Telescope/tree/master/packages/telescope-api
You could copy and extend that package to accomplish whatever you need.
Would it make sense to use Meteor when you want to replace MongoDB with a solution like ActiveResource for Rails? I'm still figuring out if this is doable and makes sense.
Basically what I want to do is couple Meteor to an external API, but still keep it's features like latency compensation, live updates etc. But I can't seem to find any examples, other than: implementing the DDP protocol. But I don't want Meteor to have direct access to MongoDB (or whatever DB is behind the API). Which would mean it should be built into the Meteor collection.
Any tips?
Lets say I want to use a different DB than Mongo in Meteor's back-end and also want to use a visualization lib like D3.js on the front-end.
Is that possible at the moment?
How complex would it be to add it by myself if not?
Thanks
https://github.com/meteor/meteor/tree/master/packages/mongo-livedata the documentation indicates that this would be the module to start with if you wanted to replace the database functionality.
You can substitute another database for MongoDB by providing a
server-side database driver and/or a client-side cache that implements
an alternative API. The mongo-livedata is a good starting point for
such a project.
-- http://docs.meteor.com/#data
Take a look at this project: https://github.com/austinrivas/meteor-postgresql. If you really need to use a database other than mongo meteor may not be the right choice unless you are experimenting. You can always aggregate data from another db to mongo which might make life easier.
I've been using D3 with meteor in the form of angularjs directives and binding the data to drive the visualizations to $scope. DDP makes keeping the data current in the d3 visualizations super convenient.