Skip to content

Instantly share code, notes, and snippets.

@kaz29
Created August 19, 2021 21:33
Show Gist options
  • Save kaz29/6109b422eb11676eaaf07ccacb101101 to your computer and use it in GitHub Desktop.
Save kaz29/6109b422eb11676eaaf07ccacb101101 to your computer and use it in GitHub Desktop.
swagger-ui on Azure Static Web App example
#!/bin/sh
if [ ! -d "$SOURCE_DIR/OUT" ];then
mkdir $SOURCE_DIR/out
fi
curl -OL https://petstore.swagger.io/v2/swagger.json --output swagger.json
cp node_modules/swagger-ui-dist/* $SOURCE_DIR/out/
cp swagger.json $SOURCE_DIR/out/
cp staticwebapp.config.json $SOURCE_DIR/out/
sed -i "s|https://petstore.swagger.io/v2/swagger.json|swagger.json|g" $SOURCE_DIR/out/index.html
{
"name": "swagger-web",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"build": "./bin/build"
},
"dependencies": {
"swagger-ui-dist": "3.52.0"
}
}
{
"routes": [
{
"route": "/",
"allowedRoles": ["reader"]
},
{
"route": "/login",
"rewrite": "/.auth/login/github"
},
{
"route": "/.auth/login/twitter",
"statusCode": 404
},
{
"route": "/logout",
"redirect": "/.auth/logout"
}
],
"responseOverrides": {
"401": {
"redirect": "/login",
"statusCode": 302
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment