Play around with GH Copilot and learn it's capabilities.
- create a github account
- get access to github copilot
- setup
- gh codespaces
- local
- install the needed extensions for your ide
- install everything needed on your local pc (but not today - we use gh codespaces!)
-
create an API endpoint that returns a menu with at least 5 items
-
create an endpoint to create an order. The API should return the total price
-
copy the following code
@app.route('/menu/<string:id>')
def participants(item_id):
connect = sqlite3.connect('database.db')
cursor = connect.cursor()
cursor.execute('SELECT * FROM menu WHERE id =' + item_id + ';')
data = cursor.fetchall()
return jsonify({'status': data})
to your code, select it and ask copilot chat if there are any issues with it.
- create a Dockerfile
tip: if you do not know how to do something, just ask github copilot chat for help :)
- open the az-deploy.sh and create an azure deployment for your app with azure cli
- create a resource group
- create an azure container registry
- get the ID for the container registry and store it in a variable
- build a container image with the container registry
- create a managed identity
- get the id of the managed identity and store it in a variable
- get the clientId of the managed identity and store it in a variable
- create a role assignment, the assignee is the client id of the managed identity, the role is
AcrPull
and the scope is the id of the container registry - create a container apps environment
- create a container app with the registry-identity (id from the managed identity), the registry-server (your-registry-name.azurecr.io), the image (your-registry-name.azurecr.io/your-image-name:latest) and the port (80)
- ask github copilot to write a (or a few) tests for your api
- (Copilot trust center)[https://resources.github.com/copilot-trust-center/]
- (Copilot Hackathon)[https://github.com/microsoft/CopilotHackathon]
- (GitHub Copilot Patterns & Exercises)[https://patterns.hattori.dev/]
- (Build an e-commerce website using GitHub Copilot Chat)[https://github.com/mosabami/createwithcopilot/blob/main/README.md]
- (Using GitHub Copilot to quickly build a Node.js application with Azure Cosmos DB and App Service)[https://moaw.dev/workshop/?src=gh%3Aazure-samples%2Fcopilot-nodejs-todo%2Fmain%2Fdocs%2F&step=0]