👜 A simple RESTful API for Purchases and Products
|Add a Product||Ability of Add a Product on the System|
|List Products||Ability of List Products|
|Edit a Product||Ability of Edit a Product|
|Delete a Product||Ability of Delete a Product|
|Stock||Ability of Update the Stock|
|Stock History||Ability to see the Stock History|
|Create a Cart||Ability of Create a new Cart|
|See Cart||Ability to see the Cart and it items|
|Remove a Cart||Ability of Remove a Cart|
|Add Item||Ability of add a new Item on the Cart|
|Remove a Item||Ability of Remove a Item from the Cart|
|Checkout||Ability to Checkout|
eCommerce it's an open source (test scenario) software made to create a easy and simple "Shop" API, where you have two micro services, one the Products API that stores and handles everything Related to Stock and Products. And the Purchase API where you can create orders (cart's) and checkout items.
The purpose of this repository it's for education and test. But the code it's being coded in a proper way.
If you have any Issue or bug you can submit a new Issue by accessing this link.
If you want to Contribute you can submit a Pull Request, remember to READ the Contributing Guide
- eCommerce it's splitted into two standalone RESTful API's, so you can run it on whatever port you want. Installing
- eCommerce it's easy, the tutorial above will explain to you.
- eCommerce uses Groovy
You can run eCommerce in different ways. You can go to the Releases Page and download the source code of the latest release, or a bundled .war or a standalone java application (.jar).
It's recommend see the notes on this section.
You can attach the .war in WebServers like Tomcat using the Management Interface.
If you want run the standalone
.jar just download it, and open your CMD/Terminal and write:
If you want RUN the Products API
java -jar ecommerce-products-api-XXX.jar OR
If you want RUN the Purchases API
java -jar ecommerce-purchase-api-XXX.jar OR
You also can build from the sources by running the Grails Console, just went to one of the API's folder
products-api and write on your CMD/Terminal the following:
If you want to run it in development scenario, you can also do it by building the sources. You have two manner to do it. You can Gradle or directly Grails. Both
purchase-api comes with Groovy, Grails and Gradle standalone packages. So you can run it without the need of installing they.
Option #1 - Run by Gradle
Option #2 - Run by Grailsw
Production Environments are focused in being ready. That means, you just need execute the Jar File.
In the Production Environment all eCommerce API's are configured to work with MySQL in two databases; productsAPI and purchaseAPI and to work with a default username and password combination:
Note.: Remember importing each SQL files, if using MySQL for Production. You can find them inside
- Username: commerce
- Password: commerceapi
- Database: productsapi & purchaseapi
- Port: 3306
You can change those credentials in the
application.yaml file. In production environments you need import the database schema before running the software. Both
purchase-api DDL files are available on this folder.
Note.: By default
products-api runs on port 8080 and
purchase-api on port 8090.
Note.: In all Development and Test Scenarios, eCommerce uses H2 in-memory Database.
Note.: You can change your database credentials both for development/test and production scenarios in the
app-config.yml available on each API sources root. Those configuration files can be used also externally, after building the
Note.: You also can clean the sources and rebuild the sources by running
Running Test Cases
You can easily run the Test Cases using the standalone Grails package built-in with both the API's. Just went to the home folder of one of them (
purchase-api). And write on your CMD/Terminal:
This development/educational scenario was coded and created by Claudio Santoro unde the GNU GPL v3 License. The objective of this repository it's as practical test of RESTful API's with Java + Groovy.