services | platforms | author |
---|---|---|
storage |
nodejs |
dineshmurthy |
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the resource originated. This sample demostrates how to enable Cors for the Blob Storage and Table services in Windows Azure, a how to perform the following tasks,
- Upload and download files from the storage using javascript in a web browser.
- Insert and query data from a table using javascript in a web browser.
If you don't have a Microsoft Azure subscription you can get a FREE trial account here
Note: This sample will overwrite any existing CORS rules in the Azure Subscription you use. No cleanup is done after the sample is run.
This sample can be run using either the Azure Storage Emulator that installs as part of the Azure SDK (In Windows only) - or by updating the app.config file the storage connection string.
To run the sample using the Storage Emulator (Azure SDK):
- Download and Install the Azure Storage Emulator here.
- Start the Azure Storage Emulator (once only) by pressing the Start button or the Windows key and searching for it by typing "Azure Storage Emulator". Select it from the list of applications to start it.
- Open the app.config file and set the configuration for the emulator ("useDevelopmentStorage":true).
- Download the dependencies with npm install.
- Run the sample by: node ./app.js
To run the sample using the Storage Service
- Open the app.config file and set the connection string for the emulator ("useDevelopmentStorage":false) and set the connection string for the storage service ("connectionString":"...")
- Create a Storage Account through the Azure Portal
- Provide your connection string for the storage service ("connectionString":"...") in the app.config file.
- Download the dependencies with npm install.
- Run the sample by: node ./app.js