This sample project is a book marketplace where,
- Sellers can sell books.
- Buyers can buy books from sellers.
- Admin can ban sellers and buyers.
You will learn the following topics by completing the tasks in this project.
- Writing REST APIs
- Using
bal persist
to connect with databases - Adding configurable variables
- Ballerina package structure
- Using connectors - gmail
- Writing unit tests.
- OAuth2 authentication
Start the oauth ballerina-sts service by executing the following command.
$ cd ballerina-sts
$ bal run
This will start a service that will provide the oauth2 functionality for the book-marketplace service.
Gmail API configurations can be obtained from this google doc.
Complete the TODOs in the book-marketplace service.
Start the book-marketplace service by executing the following command inside the book-marketplace directory.
$ bal run
You can use this postman collection to test the APIs.
Note that there is a header Authorization
that is already set. A token generated by the sts server must be provided for this header.
You can find the tokens for each user in this google doc
Generate the OpenAPI definition of the service using the openapi CLI command.