MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. WN
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    W
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Groups 0

    Posts

    Recent Best Controversial
    • "Require is not defined" Error

      I have been trying create module can cant not get rid of this error

      Uncaught ReferenceError: require is not defined
      

      I have very little experience with node, so sorry if this has been asked a lot.

      getData: function(){
      		var self = this;
      		const dataRequest = require('https');
      		const options = {
      			"method": "POST",
      			"hostname": "",
      			"port": null,
      			"path": "",
      			"headers": {
      				"content-type": "application/json",
      				"clientsecret": "",
      				"clientid": "",
      				"x-rapidapi-key": "",
      				"x-rapidapi-host": "",
      				"useQueryString": true
      			}
      		};
      
      		const req = dataRequest.request(options, function (res) {
      			const chunks = [];
      			res.on("data", function (chunk) {
      				chunks.push(chunk);
      			});
      			res.on("end", function () {
      				const body = Buffer.concat(chunks);
      				console.log(body.toString());
      			});
      		});
      

      I would use something else but the API I am trying to use shows this as an example, and I am not the best with web calls. I don’t know if this is need but the API returns as json.

      posted in Troubleshooting
      W
      WN
    • 1 / 1