This repository contains the source code for Age Color Generator back-end service. It contains all services necessary to expose endpoint and handling request.
Base URL: https://xaltius-be-test.herokuapp.com
- Endpoint: /process/age
- Request body:
{ "name":"Bayu", "age": 21 }
- Expected response:
{ "statusCode":200 "data": { "name":"Bayu", "age": 21, "colors": "#e6bbad" } }
- Spring Framework 5
- Java Servlet API
- Fasterxml Jackson Databind
- Lombok
- config (Configuration for web and servlet)
- controller (Mapping endpoint and attach the handler)
- exception (Exception handing)
- model (Model class)
- service (Service handler)
Maven required
- Clone this repository:
git clone https://github.com/bayuagpr/be-xaltius-test.git
- Move into the project directory:
cd be-xaltius-test
- Install the dependencies:
mvn clean install
`mvn clean package`
There are two options:
- Run the jar:
java -jar target/dependency/webapp-runner.jar target/*.war
- Starts a server running at http://localhost:8080
- Add --port {READY_TO_USE_PORT} to use another port
Requires the docker installed on the machine
- Build the docker image:
sudo docker build -t xaltius-be-test .
- Run the docker image:
sudo docker run -d -p 8080:8080 -t xaltius-be-test
- Starts a server running at http://localhost:8080
- Change the first port to use another port
Requires the Heroku CLI client.
- Create the Heroku app:
heroku create
- Push code to Heroku:
git push heroku master