December 2021
Intermediate to advanced
510 pages
11h 20m
English
Let’s build an API for our command-line tool to talk to. To save some time, you’ll create a REST API server that exposes data from the to-do API you developed in Defining the To-Do API. It will let users view, add, and modify to-do items using HTTP methods. You’ll reuse the code you developed before by importing the package todo from the module pragprog.com/rggo/interacting/todo.
Start by creating the directory structure for the server under your book’s root directory:
| | $ mkdir -p $HOME/pragprog.com/rggo/apis/todoServer |
| | $ cd $HOME/pragprog.com/rggo/apis/todoServer |
Then, initialize the Go module for this project:
| | $ cd $HOME/pragprog.com/rggo/apis/todoServer |
| | $ go mod init ... |
Read now
Unlock full access