MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    missing 'Access-Control-Allow-Origin'

    Scheduled Pinned Locked Moved Troubleshooting
    10 Posts 6 Posters 6.1k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      KrawallKurt
      last edited by

      I am facing the same problem. Could you please give an example, how you used node_helper.js to circumvent the access-allow-origin policy?

      Thanks!

      1 Reply Last reply Reply Quote 0
      • yawnsY Offline
        yawns Moderator
        last edited by

        Like here for example:
        https://github.com/yawnsde/MMM-RNV

        You use request instead.

        1 Reply Last reply Reply Quote 0
        • K Offline
          KrawallKurt
          last edited by KrawallKurt

          Thank you!

          And why does it have to be in node_helper, not in the main script? Sorry, if this question sounds stupid, I’m new to developing modules.

          Also, is there a reason for declaring var self = this; and using self.func instead of this.func? I have seen this quite a bit and couldn’t understand why people do this…

          yawnsY 1 Reply Last reply Reply Quote 0
          • yawnsY Offline
            yawns Moderator @KrawallKurt
            last edited by

            @KrawallKurt
            Please note I am not an experienced javascript developer either. When using addon modules/libraries like request you use the node_helper.js to load this library. I am not sure if it is not possible at all to do so in the main module file or if it is just complicated. Maybe @strawberry-3-141 can clarify :)

            self = this was used in other modules and I added it to my module as well, because I did not want to possibly break something by leaving it out. There is a lot of discussion on the web why this is used and if this still should be used.

            1 Reply Last reply Reply Quote 0
            • K Offline
              KrawallKurt
              last edited by

              Concerning the self=this question, I found a neat article giving som explanations: https://alistapart.com/article/getoutbindingsituations

              The other question: Could it be, that node_helper is executed on the server and the main script is executed on the client?

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy