Exercise 2: Working with REST APIs
Let’s test our understanding by attempting this challenge.
We'll cover the following
Let’s practice what we’ve learned so far. The solution to this exercise will be provided in the next lesson.
Problem
Change the restdb
package (restdb.go
) to support SQLite instead of PostgreSQL, then execute the useRestdb.go
code provided in the playground below. Additionally, ensure that the create_db.sql
and useRestdb.go
files are adjusted accordingly. Subsequently, run the provided useRestdb.go
code within the playground environment.
Following are the commands required to execute the useRestdb.go
code:
Note: The
restdb.go
code file needs to be present in the$GOROOT/src
directory so that it can be imported as a package in theuseRestdb.go
code.
To copy the
restdb.go
file in the$GOROOT/src/restdb
directory, enter the following:
Get hands-on with 1400+ tech skills courses.