I recently installed unirest.
In their documentation they provided the following piece of code to test unirest:
var unirest = require('unirest');
unirest.post('http://mockbin.com/request')
.header('Accept', 'application/json')
.send({ 'parameter': 23, 'foo': 'bar' })
.end(function (response) {
console.log(response.body);
});
When I add this bit of code, I get the following error in my console:
Error: require is not defined
The entire UI of my site stops working as well.
I've used require in the past before and it's never given me this error. Is there something I'm forgetting to include?
EDIT: Forgot to mention. Yes, I am running this in a Node.js environment.