morishin / azure-static-web-apps-template

A web application example using Vite, React, TypeScript, GraphQL and hosted on Azure Static Web Apps

Home Page:https://green-island-0e0ec2900.1.azurestaticapps.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Azure Static Web Apps Template

A web application example using Vite, React, TypeScript, GraphQL and hosted on Azure Static Web Apps.

You can see the running app here: https://green-island-0e0ec2900.1.azurestaticapps.net/.

This app uses:

Setup

Run the following command.

dev/setup

You can set environment variables read from Azure Functions in local.settings.json. Copy and edit the file as the following command.

cp api/local.settings.json.example api/local.settings.json

Recommended

Useful VS Code extension for developing Azure Static Web Apps: https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps

Run

The following command will start both API and frontend application.

dev/start
  • You can open http://localhost:4280/ in your browser.
  • dev/start runs also graphql-codegen --watch to generate GraphQL types implementations when you modify GraphQL schema.
  • Frontend app hot-reloads by Vite dev server and API app restarts by nodemon when the code generation occurs or you modify some codes.

API only

Run only API app by the following command.

cd api
yarn dev

Deploy

Example app: https://green-island-0e0ec2900.1.azurestaticapps.net/

You can deploy your own app as Azure Static Web Apps.

  1. Clone this repository, run setup, and remove .github directory including an example azure app info.
  2. Create Azure Static Web App. See https://docs.microsoft.com/en-US/azure/static-web-apps/getting-started?tabs=vanilla-javascript.
    • Specify / as an app location and dist as an output location.
  3. Auto-generated GitHub Actions deploy this app when codes are pushed to main branch 🚀

LICENSE

MIT

About

A web application example using Vite, React, TypeScript, GraphQL and hosted on Azure Static Web Apps

https://green-island-0e0ec2900.1.azurestaticapps.net/


Languages

Language:TypeScript 88.5%Language:Shell 7.6%Language:HTML 2.0%Language:CSS 1.9%