Make sure you've installed the following requirements before building the proejct.
Docker | Docker enables to build, develop, run your environments. Please install the latest for your platform. Docker. |
Maven | Maven is a software proejct management tool. Please install the latest for your platform. Maven. |
-
Run maven package command to build the project and generate JAR file.
mvn clean package
-
Pull the Docker image and startup your local environment.
docker build . -t crm_webapp
-
Build the Docker container of CRM web application
docker run --name crm_webapp -p 16500:8080 -v $(pwd)/target/:/tmp/target/ -it crm_webapp
You have two options:
-
Using CURL command to interact with REST APIs
a. Request to register user authentication information. Specify the following field properties.
Name Type Description username String The username password String The password authority String The role-based access control the endpoints, list the following roles and permissions. - ROLE_ADMIN: grant all permissions to the endpoints.
- ROLE_MANAGER: grant permission to modify, delete and view the endpoints
- ROLE_OPERATOR: grnat the permission to create and modify the endpoints.
curl -v -X POST \ -H 'Content-Type: application/json' \ -d '{"username": "smartbee_test_01", "password": "test", "authority": "ROLE_OPERATOR"}' \ 'http://localhost:16500/api/crm/v1/users'
b. Authenticate user permission with created username and password, it would be authorized and generate unique JWT token to the client.
curl -v -X POST \ -H 'Content-Type: application/json' \ -d '{"username": "smartbee_test_01", "password": "test"}' \ 'http://localhost:16500/api/crm/v1/authenticate' {"token":"..."}
c. Request
company
,client
resource with authorization header.curl -v -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer {JWT token}' -d '{"name": "test", "email": "crm_test_01@smartbee.com", "phone": "0905000000", "companyId": 1}' \ 'http://localhost:16500/api/crm/v1/clients'
-
Visit the OpenAPI (Swagger) dashboard via http://localhost:16500/swagger-ui/index.html