Here is my code: http://pastebin.com/rZKRTGUB
I am not sure why I am getting require is not defined on Line 4
Here is my code: http://pastebin.com/rZKRTGUB
I am not sure why I am getting require is not defined on Line 4
require
is part of the node runtime environment and does not exist in browsers. It looks like you're trying to run this in the browser (in the <script>
tags). Likely, you should be creating a server in node and then using the code you've written to talk to the database.
Yours is client side code, so require()
is obviously not defined.
You either move your code in a node server or you drop http://requirejs.org/docs/download.html in your script if you want to use that API in the browser.