Explore a Flask example. Learn about library use, server setup, MongoDB interaction, and language syntax. Learn about the GET command for the quote list and individual quote, then create a "random" endpoint to get a random quote.
- [Instructor] Now let's direct ourselves…toward the Python example.…You can find the code for this section…in the exercise files directory.…We'll explore the code and get started with code changes.…At the top of the script,…we're performing the needed imports.…The first three lines are specific to using Flask,…then there's the BSON utility…used for formatting Mongo database responses.…OS gives us some handy functionality…related to the operating system,…and we'll import a random number generator for use in a bit.…Once the imports are complete,…we define the app as a Flask object…using the test database.…
The API, using the API library,…and create a Mongo object…for accessing the database directly.…Additionally, before we get started,…we'll set up a parser to handle arguments…passed in with a request.…We'll see how that works when we cover write operations…in a later video.…Because Python and Flask are object oriented,…the structure here is designed around creating classes…and then accessing them.…At the most outer level is the QuoteList class.…
- Why become a polyglot programmer?
- Exploring Node.js, Python, Perl, and Ruby code
- Building on prior knowledge to learn new programming languages
- Learning API read and write functionality in Node.js, Python, Perl, and Ruby
- Implementing API functionality in Node.js, Python, Perl, and Ruby
Skill Level Intermediate
Building APIs Using Hapi in Node.jswith Kirsten Hunter2h 23m Intermediate
1. Becoming a Polyglot
Next steps1m 19s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.