今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Introducing the Orders app
- [Instructor] Let's have a look at a more interesting example than Hello World. One of the common uses of Go is to use it to build server side applications. I've prepared precisely such an application for us to look at today. I've built a simple REST API, which allows us to place orders for our drinks web shop. It is a basic app that exposes the following functionality. Viewing the list of products and their amount of stock. Placing a new order if it is valid and we have enough stock. And viewing an order once it has been placed. To achieve this, I have configured four endpoints in our REST API. The GET route endpoint simply returns a hard-coded response. The GET products endpoint shows us all product information. There are also two orders endpoints. We create a new order by using the POST on the orders endpoint We get an existing order using a GET on the orders endpoint and supplying an order ID as a URL parameter.…