Create Endpoint
Learn how to create an endpoint to insert a new product.
We'll cover the following...
Creates the handler
In this lesson, we need an endpoint that receives the parameters through the webserver.
We need to make our create_product
function public. To do so, we add the pub
keyword at the beginning to change the corresponding line.
Press + to interact
pub fn create_product(new_product: NewCompleteProduct, conn: &SqliteConnection) -> Result<i32> {
We also need to add derive
...