wonderful world
wonderful world

Reputation: 11599

Authenticating documentDB REST API calls

In this sample application, the name of the HOST and KEY are added to the config.json file. When the application is run in the browser, will this configuration be downloaded to the user's computer? Can someone help me to understand what js file is being downloaded to the users computer, and what js file runs on the server?

Upvotes: 0

Views: 294

Answers (1)

Andrew Liu
Andrew Liu

Reputation: 8119

The short answer is no, config.js lives only on the server. The sample app you mentioned is written using Node.js (which is a server-side javascript run-time) using the Express framework.

By default, you should assume every file lives on the server (unless it is explicitly exposed).

For the sample app, anything in the /public/ directory (which contains a simple .css stylesheet) is exposed to the client. This is exposed by app.js on line 29: app.use(express.static(path.join(__dirname, 'public')));

You can find the full code sample for the tutorial you mentioned on github: https://github.com/Azure/azure-documentdb-node/tree/master/tutorial/todo

Upvotes: 1

Related Questions