I am using angularjs where i have created a js file(loginCtrl.js) and i have inclused a controller.
I have defined my db connection and schema in another file(server.js) and
require() is a NodeJS function, your angular controller will be executed in the browser, which doesn't have that built-in function. If you want to replicate that behavior client-side, you should look at RequireJS