Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

code-star/codestar-website-azure-functions

Repository files navigation

⛔️ ARCHIVED - we are now using static site generation https://github.com/code-star/codestar-website-next

Passionate programmers standing to make a change


Codestar blog Azure functions

See individual README files in each Azure function directory for more information

This repo replaces the AWS Lamdbas in codestar-website-functions

Contents:

  1. Requirements
  2. Developing
  3. Deploying

Requirements

Uses Node 16 (latest Node version available on Azure).

When nvm is installed, this Node version can be activated by running nvm use in the root of the project.

Developing

Azure function documentation: https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-typescript

  • Make sure this is installed: npm install -g azure-functions-core-tools
  • configure a .env file in the root of the project with values for:
TWITTER_ACCESS_TOKEN=bearer_token_from_twitter_dashboard
TWITTER_USER_NAME=some_twitter_handle_without_@
YOUTUBE_API_KEY=a_valid_youtube_api_key
YOUTUBE_PLAYLIST_ID=some_playlist_id

and

  • in VS Code run with F5

or

  • npm i
  • npm start (manually restart on each change)
  • in VS Code, in the Azure toolbar under Workspace > Functions > GetTweets, right click and "execute function now"

Deploying

  • set envars in Azure Function App console under > configuration > Application settings, add:
TWITTER_ACCESS_TOKEN=bearer_token_from_twitter_dashboard
TWITTER_USER_NAME=some_twitter_handle_without_@
YOUTUBE_API_KEY=a_valid_youtube_api_key
YOUTUBE_PLAYLIST_ID=some_playlist_id
  • CORS: in Azure Function App console under > API > CORS
  • Slots (stages/test environment): in Azure Function App console under > Deployment > Deployment slots
    • add a stage: codestar-website-api-test

Deploy to Test Slot:

  • in VS Code, in the Azure toolbar under Resources, expand codestar-website-api > Slots > test and right-click. Click "deploy to slot"

Deploy to Prod Slot:

  • in VS Code, in the Azure toolbar under Resources, expand codestar-website-api > Slots > test and right-click. Click "Swap slot..."
  • select the production slot

or:

  • in VS Code, in the Azure toolbar under Workspace > click the "deploy" icon (cloud with up arrow), select the correct Resource Group and the codestar-website-api Function App. Allow overwriting the existing deployment.

TODO

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published