Read the statement by Michael Teeuw here.
This might be a daft question, but...
-
@ronny3050 Thanks for your reply
Will I get any kind of intellisense in the IDE?
Also, do I develop on the Pi itself or can I do develop/test on my Windows machine?
-
@Mitchfarino yes you do get intellisense, which helps when you are requiring core node modules to easily find out the function you’re looking for.
You should always develop on your local machine before deploying it to the pi. This way your code is generic and you won’t have memory issues. Not to mention, there’s no lag if you’re sshing into pi and can see results straightaway without having to restart mm all the time. -
I use Notepad++, it does the job for me. However, I have other editors that I use for heavier tasks, like when I’m writing C/C++ code. For a peek at my crazy dev environment, read this post: https://forum.magicmirror.builders/topic/265/my-setup-or-how-crazy-i-am
-
Visual Studio Code rocks! It’s relatively new, but it’s very lightweight, run on any platform, includes intellisense and bunch of addins. Allows you debugging in the node.js…
-
If you happen to have a Mac CodeRunner is amazing! It can compile and execute a lot of different programming languages and is really fast. Atom (Windows, Linux, Mac) is also really nice but I quite often find myself using CodeRunner instead because Atom needs so much CPU and is also a lot slower compared.
-
Can I use Visual Studio?
What type of project would I create?
-
@Mitchfarino Most certainly you should be able to. There are node.js specific projects. You just need to install tools:
https://beta.visualstudio.com/vs/node-js/ -
Thanks @alexyak , much appreciated!
-
Sorry, again
Which of these projects would be the correct one?!

-
@Mitchfarino Sorry, I’ve not tried this yet myself, but have you tried to use this option that you have selected: “From Existing Node.js code”?
-
@alexyak Sorted, I tried that and imported an existing module
Now I just to figure out what I’m doing now! :)
-
OK, I’m up and running, but I’m not sure how to parse my JSON result in to html.
I have this, but don’t know whether it’s correct
I just want to see if I can list the names from the results of my GET request
getDom: function () { var wrapper = document.createElement("div"); $.getJSON(this.url, function (data) { var tr; for (var i = 0; i < data.length; i++) { tr = $('<tr/>'); tr.append("<td>" + data[i].name + "</td>"); $('table').append(tr); } wrapper.append("<td>" + data[i].name + "</td>"); }); return wrapper;I’d like to note, this is all completely new to me, so I’m trying to learn as I go…
-
@strawberry-3-141 I saw you were online, so I’m shamelessly tagging you in my post in the hopes of some guidance :-(
-
getDom: function () { var wrapper = document.createElement("div"); var table = document.createElement("table"); $.getJSON(this.url, function (data) { for (var i = 0; i < data.length; i++) { var row = document.createElement("tr"); var name = document.createElement("td"); name.innerHTML = data[i].name; row.appendChild(name); table.appendChild(row); } wrapper.appendChild(table); return wrapper; });but I’m pretty sure that this will not work, because the return is in an asynchronous callback, i would do a different structure call your url in an interval somewhere else and save your data into an module variable and call the updateDom function after a result, then in getDom you iterate over the data.
-
@strawberry-3.141 Thanks very much, I’ll have a play with it over the weekend and hopefully I get can something working
I’ve not done anything like this before really, so just jumping in and seeing what happens :-)
-
url: "", //Insert your url here result: false, defaults: { updateInterval: 30 * 60 * 1000 //Every 30 mins }, start: function(){ this.getData(); setInterval(()=>{ this.getData(); }, this.config.updateInterval); }, getDom: function() { var wrapper = document.createElement("div"); if(this.result){ var table = document.createElement("table"); for (var i = 0; i < this.result.length; i++) { var row = document.createElement("tr"); var name = document.createElement("td"); name.innerHTML = this.result[i].name; row.appendChild(name); table.appendChild(row); } wrapper.appendChild(table); } else { wrapper.innerHTML = "No data to show!"; } return wrapper; }, getData: function(){ $.getJSON(this.url, (data) => { this.result = data; this.updateDom(); }); } -
@strawberry-3.141 Thanks for this, I’ll see if I can get it working
-
@strawberry-3-141 once I’ve got some code, how do I test it on my mirror?
Just copy the folder to the modules folder and add it to the config, or is there something else I need to do?
Thanks
-
@Mitchfarino no that’s it :)
-
@paviro Awesome, thank you!
I’m stumbling my way through, hopefully I’ll have something working soon :)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login