LAB - Class 16
- Create a repository on Github and link it to Vercel account.
- Use requests library to interact with REST Countries API
- Create a serverless function following Vercel’s get-started directions that handles two kinds of queries:
- The serverless function should handle a GET http request with a given country name that responds with a string with the form The capital of X is Y
- E.g./capital-finder?country=Chile should generate an http response of The capital of Chile is Santiago.
- The serverless function should handle a GET http request with a given capital that responds with a string with the form The capital of X is Y
- E.g./capital-finder?capital=Santiago should generate an http response of Santiago is the capital of Chile.
API - https://restcountries.com/#rest-countries
Severless server url - https://capital-finder-pearl.vercel.app/api/capitals
cat requirements.txt
PORT - 3000
DATABASE_URL - URL to the running Postgres instance/db
How to initialize/run your application (where applicable)
Local host - vercel dev
pip install requests
• How do you run tests?
• Any tests of note? none
• Describe any tests that you did not complete, skipped, etc
Deployed site:
https://capital-finder-pearl.vercel.app/api/capitals?word={capital_name}
Notes: