Skip to content

Latest commit

 

History

History
81 lines (58 loc) · 2.19 KB

README.md

File metadata and controls

81 lines (58 loc) · 2.19 KB

Web app / Web API with azure AD demo

Usage

Start the web-app and web-api and then visit localhost:3000. Adapted from the active-directory-node-webapi exmaple app and this course.

Note that the environment varialbes are set with powershell syntax below. Adjust for your terminal accordingly

run the web app locally

Set environment variables:

$env:tenantName = "myAzureTenantName"
$env:tenantID = "12341234-1234-1234-12341234123412341"
$env:clientID = "1324asdf-1234-asdf-1234asdfasdfasdfa"
$env:clientSecret = "thesecretyoucreatedforyourapp123"
$env:appURI = "https://myAPIregistrationURI"

Then run the app:

cd web-app
npm install
npm start

run the web app locally with docker

Set environment variables as above then build and run the docker container:

Note that the only reason to do this is to test out the docker build, since the api running in a lonely docker container has no way to call out to the API that might be running in another the docker container or from the command line

cd web-app
docker build . -t web-app
docker run --rm -it -e tenantName -e tenantID -e clientID -e clientSecret -e appURI -p 3000:3000 web-app

run the API app locally

Set environment variables taken from the overview blade of the web-api registration:

$env:tenantName = "myAzureTenantName"
$env:tenantID = "12341234-1234-1234-12341234123412341"
$env:clientID = "abcdabcd-abcd-abcd-abcdabcdabcdabcda"
$env:audience = "https://myAPIregistrationURI"

Then run the app:

cd api-server
npm install
npm start

run the API app locally with docker

Set environment variables as above then build and run the docker container:

cd api-server
docker build . -t web-api
docker run --rm -it -e tenantID -e clientID -e audience -p 5000:5000 web-api

run the web-app and the web-api locally (docker-compose)

Update the environment varialbe definitions in the docker-compse.yml file with the values above, and run:

docker-compose build
docker-compose up