- Learning Functional Programming in Go
- Lex Sheehan
- 69字
- 2021-07-02 23:13:43
RESTful server
If we have our RESTful server running on port 8000, we can open our web browser to http://localhost:8000/cars/1 and see the following:
{
"index": 1,
"car": "Honda Accord ES2"
}
This is a representation of an IndexedCar struct. It has an index and a car make and model string.
Here's the actual IndexedCar struct in types.go:
IndexedCar struct {
Index int `json:"index"`
Car string` json:"car"`
}