Skip to content

Commit 6d9092b

Browse files
Added instructions to run quiz app locally and on Azure
1 parent d0cf3ac commit 6d9092b

File tree

1 file changed

+92
-21
lines changed

1 file changed

+92
-21
lines changed

quiz-app/README.md

Lines changed: 92 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,106 @@
11
# Quiz app
22

3-
This quiz app helps you display questions and answers in a quiz format.
3+
These quizzes are the pre- and post-lecture quizzes for the data science curriculum at https://aka.ms/webdev-beginners
44

5-
## Install the app
5+
## Run the Quiz App locally
66

7-
Run `npm install` to install the dependencies.
7+
### Prerequisites
88

9-
```sh
10-
npm install
11-
```
9+
- A GitHub account
10+
- [Node.js and Git](https://nodejs.org/)
1211

13-
## Build the app
12+
### Install & Setup
1413

15-
To build the solution, run `npm run build`.
14+
1. Create a repository from this [template](https://github.com/new?template_name=Web-Dev-For-Beginners&template_owner=microsoft)
1615

17-
```sh
18-
npm run build
19-
```
16+
1. Clone your new repository, and navigate to the quiz-app
2017

21-
## Run
18+
```bash
19+
git clone https://github.com/your-github-organization/repo-name
20+
cd repo-name/quiz-app
21+
```
2222

23-
To run the solution, run `npm run dev`.
23+
1. Install the npm packages & dependencies
2424

25-
```bash
26-
npm run dev
27-
```
25+
```bash
26+
npm install
27+
```
28+
29+
### Build the app
30+
31+
1. To build the solution, run:
32+
33+
```bash
34+
npm run build
35+
```
36+
37+
### Start the App
38+
39+
1. To run the solution, run:
40+
41+
```bash
42+
npm run dev
43+
```
44+
45+
### [Optional] Linting
2846

29-
## Lint
47+
1. To ensure the code is linted, run:
3048

31-
To ensure the code is linted, run `npm run lint`.
49+
```bash
50+
npm run lint
51+
```
52+
53+
## Deploy the Quiz-app to Azure
54+
55+
### Prerequisites
56+
- An Azure Subscription. _Cost Estimate: FREE_
57+
58+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.StaticApp)
59+
60+
Once you are signed in on Azure through the link above, select a subscription and resource group then:
61+
62+
- Static Web App details: Provide a name and select a hosting plan
63+
- GitHub Login: Set your deployment source as GitHub then log in and fill in the required fields on the form:
64+
- *Organization* – Choose your organization.
65+
- *Repository* – Select the Web Dev for Beginners curriculum repository.
66+
- *Branch* - Select a branch (main)
67+
- Build Presets - Azure Static Web Apps uses a detection algorithm to detect the framework used in your application.
68+
- *App location* - ./quiz-app
69+
- *Api location* -
70+
- *Output location* - dist
71+
- Deployment: Click 'Review + Create', then 'Create'
72+
- Post-Deployment: After deployment is complete, click on 'Go to Deployment' then 'View app in browser'.
73+
74+
### Example Workflow File
75+
76+
Here’s an example of what the GitHub Actions workflow file might look like:
77+
name: Azure Static Web Apps CI/CD
78+
```
79+
on:
80+
push:
81+
branches:
82+
- main
83+
pull_request:
84+
types: [opened, synchronize, reopened, closed]
85+
branches:
86+
- main
87+
88+
jobs:
89+
build_and_deploy_job:
90+
runs-on: ubuntu-latest
91+
name: Build and Deploy Job
92+
steps:
93+
- uses: actions/checkout@v2
94+
- name: Build And Deploy
95+
id: builddeploy
96+
uses: Azure/static-web-apps-deploy@v1
97+
with:
98+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
99+
repo_token: ${{ secrets.GITHUB_TOKEN }}
100+
action: "upload"
101+
app_location: "quiz-app" # App source code path
102+
api_location: ""API source code path optional
103+
output_location: "dist" #Built app content directory - optional
104+
```
32105

33-
```bash
34-
npm run lint
35-
```
106+
Once your GitHub Action is executed successfully, refresh the live page to view your application.

0 commit comments

Comments
 (0)