Skip to content

Latest commit

 

History

History
105 lines (68 loc) · 3.28 KB

README.md

File metadata and controls

105 lines (68 loc) · 3.28 KB

TwoWeeksReady API

Build Status

Prerequisites

.NET SDK 6.0

Azure Functions Core Tools 4

npm i -g azure-functions-core-tools@4 --unsafe-perm true

Using VS Code

Open the api.code-workspace in VS Code.

You will need to install Azurite as a Storage Emulator if using VS Code for API development:

npm install -g azurite

Alternatively, there is an Azurite VS Code Extension:

Install Azure Extension

Using Visual Studio 2022

Open the api.sln in Visual Studio 2022.

You will also need the Azure Storage Emulator if using Visual Studio 2022 (if you're using VS Code, look above).

Install Azure Storage Emulator

Setup Azure CosmosDB

For local development, you can run the Azure Cosmos DB Emulator if you are developing on Windows. If not, you will need to create a CosmosDB instance in your own Azure account. You can use the Azure ComsoDB Free Tier

You will also need to create a SQL API database named 2wr and the following containers:

Container Partition Key
basekits /id
emergencykits /userId
hazardinformation /id
hazardhunts /id
familyplan /userId

Alternately, you can run the tool in:

> cd ..\tools\CosmosEmulator

> dotnet run /setup

This will create the database and collections for you.

Create a local.settings.json

Create a local.settings.json file in the TwoWeeksReady project folder. You will need to set the CosmosDbConnection setting to your own CosmosDB instance.

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "OidcApiAuthSettings:Audience": "https://2wrdev.azurewebsites.net",
    "OidcApiAuthSettings:IssuerUrl": "https://login.2wr.org/"
  },
  "ConnectionStrings": {
    "CosmosDBConnection": "AccountEndpoint=https://localhost:8081/;AccountKey=YOURLOCALACCOUNTKEY",
  "StorageConnection": "UseDevelopmentStorage=true"
  },
  "Host":{
    "CORS": "*"
  }
}

CodeTour Onboarding

In VSCode, you can get a walk-through of the code via the CodeTour extension. Install this extension, and review tours available in the 'CodeTour' folder.

CodeTour API file and panel with the Open tour file selected.

Development Workflow

Compile

dotnet build

Run from the command line

func start --build

Debug from VS Code menu

F5