Not connecting to database with node.js

What you are trying to do without knowing it, is build a RESTful API. In web architecture, you have your front end code (browser javascript) which makes HTTP requests to a backend. That backend will connect to the database and run queries. Even if you wanted to do this from browser javascript, your browser wouldn’t let you. I would recommend you write a REST Api using NodeJS, and have your browser javascript make HTTP requests to that backend. Hope this helps.

NodeJS is not jquery, nodeJs it runs on a backend web server.

you can use Meteor for connecting to database from the client side.

Read more here: Source link