I'm building an app that uses only Polymer to structure the frontend. As a backend I'd really like to use Meteor with their Mongo realtime database.
I only need the part of Meteor that implements the DDP prototcol and provides the Mongo API to the client. Is it currently possible to remove the rest of the client libraries? I don't need jQuery, Blaze, Tracker and so forth.
I've already tried removing meteor-platform from the project, then adding all the packages meteor-platform consists of. This results into errors like ReferenceError: Meteor is not defined. It seems like this is not supported currently.
What I then used was Asteroid which is really nice. But using it prevents me from using Meteor packages like GroundDB for example.
Reading on the Meteor website gives me the feeling that it should be possible to use only some parts of Meteor, but this doesn't work for me.
What's the best way to tackle this problem?
Edit: I've uploaded a leaderboard example with the failing setup on GitHub. Meteor.isServer is causing the error. If you comment out the server stuff it works.
You're missing two packages:
meteor add meteor underscore
The meteor package is the one that exposes Meteor.isServer.
Related
I've recently been having trouble with this. Is it possible to have reactjs and Parse Server(not the SDK) running and taking requests in the same node project?
If so, how?
Yes you can do it.
You can use yarn workspaces to share some packages between theses two project
You have to create two different workspaces, one for the frontend and another for the backend
Here is more information about it. They have a really nice documentation
Sorry if this is a dumb question, I've tried to google for the answer and can't find anything definitive.
I added the following package https://atmospherejs.com/rcy/nouislider
by entering the command meteor add rcy:nouislider
I am unsure if there any more steps from here. Do I need to import the package at the top of my JS file or can I go ahead and just start using it without any other steps?
Atmosphere packages should not need to be imported. The older packaging system did that for you, and the global variable 'noUiSlider' should be available to your code for you to use like in the documentation.
If you are interested, you can download the package code and see how it's put together. Just like a Meteor project there is client and server code. See here for more details: https://guide.meteor.com/writing-atmosphere-packages.html
I have been searching for generating QR Code on Meteor Server.
But so far I have found the libraries which works only on Meteor Client.
So is there any library for Meteor which can generate QR Code on Meteor Server side?
I am a novice at Meteor and I have NOT TRIED this solution, but it seems plausible.
At the core of Meteor is NodeJS which has many more solutions available than you'll find for Meteor in Atmospheres, including QR code image generation. #Arunoda seems to have "hacked" together a way to run most anything under NPM...
https://atmospherejs.com/meteorhacks/npm
Once you have that working, you can probably use this handy NodeJS QR Code library...
https://www.npmjs.com/package/qrcode-npm
I'm trying to incorporate a Twitter Bootstrap template with Meteor and I'm having trouble understanding how I should include files. For example, let's start with Bootstrap itself, should I install it with Meteor/Meteorite or do it manually with script includes? Same for other javascript plugins (e.g. jquery <- this one is builtin to Meteor right?, lightbox.js.. etc.)
Hope I'm making sense, thanks!
By default meteor already includes jquery.
It's best to look to get your plugins installed via Meteorite. So something like this could get you started
sudo -H npm install -g meteorite
Then in your project directory
mrt add bootstrap-3
For other plugins you can't find on atmosphere add the files into a directory in your project /client/lib. Meteor will automatically reference the files for you, both css and js.
This way they only run on the client side and are loaded first. (such as lightbox.js)
You might have to modify a few files with Meteor, though. In meteor each file's variables are file-scoped. So you can't access them from other files. (meteor basically throws a (function() {..}).call() around the code.
So if you get some kind of issue about a variable being undefined look for the variable and remove the var keyword and remove it so that the variable/method becomes global. With jquery plugins this usually isn't a problem.
Most that have the variable scoping issues are on http://atmosphere.com so you shouldn't run into too many problems.
The most common libraries such as jQuery and Bootstrap (v2.3.0) are provided by the Meteor core (v0.6.6.3). They can be listed using meteor list and included with meteor add.
As referred before, Atmosphere is a collection of unofficial Meteor packages giving an easy way with Meteorite to include even 3rd party solutions to your own project.
Moreover, you should learn the Meteor App structure. Directories created on your project have different preferences in terms of files visibility and loading order. I recommend reading Ritik Malhotra's presentation about the App structure at http://www.slideshare.net/RitikM/building-a-production-ready-meteor-app. There's also a Youtube video about his presentation that can be watched here http://www.youtube.com/watch?v=gfFGjmiKfnA.
I want to write a javascript library that works like an SDK for an external API.
Ideally this library could be used both for frontend projects, in the browser and for backend projects using node.js.
Initally I wasn't considering node so I was planning to require jquery as a dependency for using the ajax functions (for making the API calls) and deffered objects, but now I have second thaughts.
Considering that my goal is to have the same code base for both scenarios what do you think I should do? Is using the jquery npm package a good idea, or do you have other suggestions?
You can use the jquery package from the npm repo without problems.