Skip to content

jiwonhan1/serverless-api-cloud-database

Repository files navigation

Serverless Compute and Cloud Database

building an serverless compute with Azure functions and connect it to Cosmos Db 5/12/2020

By Jiwon Han

1. Description

Azure function is a serverless framework that helps you to develop and deploy serverless applications.

I have created all four CRUD functionalities about heroes, and connected data with Cosmos Db using MongoClient. MongoClient is the interface between our program and MongoDB server. I set the CosmosDBConnectionString to pass the result from calling functions to database.

When start debugging, there are four CRUD https.

2. Postman

Below are images for API tests in Postman.

Create function test

Get function test

3. Development

Tech stack:

Extensions and Packages used

  • Azure Cosmos DB Azure Functions in Visual Studio
  • mongodb package

To run dev mode locally:

  $ git clone 
  $ cd the repository
  $ npm install

After successfull package installation, run the Attach to Node debug. Now, it will automatically give you four http urls for each functions. You can test it with Postman or Swagger UI.

3. Solved Bugs

  1. File \AppData\Roaming\npm\ng.ps1 cannot be loaded. The file npm\ng.ps1 is not digitally signed Angular Error when running commands

I ran command from Visual Studio Code Terminal and got above issue. I solved this by running following command from the same terminal.

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

  1. ReadOnly setting
Your app is currently in read only mode because you are running from a package file. To make any changes update the content in your zip file and WEBSITE_RUN_FROM_PACKAGE app setting.

I changed WEBSITE_RUN_FROM_PACKGE's setting value from 1 to 0. Now editing is available on App Functions.

Releases

No releases published

Packages

No packages published