Skip to content

Latest commit

 

History

History
139 lines (101 loc) · 2.92 KB

README.md

File metadata and controls

139 lines (101 loc) · 2.92 KB

@jackdbd/wasm-news

Application that retrieves news about webassembly from several APIs (Reddit, Twitter, etc) and populates this Google Sheets worksheet.

Development

Build and watch the web application with tsc in watch mode and launch the application with NODE_ENV = development:

npm run dev -w packages/wasm-news

Build

non-containerized application

Build the web application:

npm run build -w packages/wasm-news

Start the application in a development / test environment:

npm run start:development -w packages/wasm-news
npm run start:test -w packages/wasm-news

containerized application

Build a container image with pack:

npm run container:build -w packages/wasm-news

Start the containerized application in a development / production / test environment:

npm run container:start:development -w packages/wasm-news
npm run container:start:production -w packages/wasm-news
npm run container:start:test -w packages/wasm-news

Deploy to GCP Cloud Run

Deploy to Cloud Run using the cloudbuild.yaml file:

npm run deploy -w packages/wasm-news

Test

npm run test -w packages/wasm-news

Healthcheck

curl "$WASM_NEWS_URL/health" \
-H "Authorization: Bearer $(gcloud auth print-identity-token)"

Retrieve data from GitHub

curl -X POST \
-L "$WASM_NEWS_URL/github" \
-H "Authorization: Bearer $(gcloud auth print-identity-token)" \
-H "Content-Type: application/json" \
-d '{
    "n_days": 5
}'

Retrieve data from Reddit

curl -X POST \
-L "$WASM_NEWS_URL/reddit" \
-H "Authorization: Bearer $(gcloud auth print-identity-token)" \
-H "Content-Type: application/json" \
-d '{}'

Retrieve data from Twitter

curl -X POST \
-L "$WASM_NEWS_URL/twitter" \
-H "Authorization: Bearer $(gcloud auth print-identity-token)" \
-H "Content-Type: application/json" \
-d '{}'

Retrieve data from Stack Overflow

curl -X POST \
-L "$WASM_NEWS_URL/stack-overflow" \
-H "Authorization: Bearer $(gcloud auth print-identity-token)" \
-H "Content-Type: application/json" \
-d '{}'

Delete all rows in the github worksheet

curl -X DELETE \
-L "$WASM_NEWS_URL/github" \
-H "Authorization: Bearer $(gcloud auth print-identity-token)"

Delete all rows in the reddit worksheet

curl -X DELETE \
-L "$WASM_NEWS_URL/reddit" \
-H "Authorization: Bearer $(gcloud auth print-identity-token)"

Delete all rows in the stack_overflow worksheet

curl -X DELETE \
-L "$WASM_NEWS_URL/stack-overflow" \
-H "Authorization: Bearer $(gcloud auth print-identity-token)"

Delete all rows in the twitter worksheet

curl -X DELETE \
-L "$WASM_NEWS_URL/twitter" \
-H "Authorization: Bearer $(gcloud auth print-identity-token)"