Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrianmarino/api-orders
https://github.com/adrianmarino/api-orders
java-8 rest-api springboot2
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/adrianmarino/api-orders
- Owner: adrianmarino
- Created: 2019-07-28T18:04:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-31T21:22:09.000Z (almost 4 years ago)
- Last Synced: 2023-02-27T13:46:41.835Z (almost 2 years ago)
- Topics: java-8, rest-api, springboot2
- Language: Java
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# API Orders
### Requisites
* **Java 8**: i.e. install using sdkman:
```bash
curl -s "https://get.sdkman.io" | bash
sdk install java 8.0.222-amzn
```* **Maven**: i.e. install using sdkman:
```bash
sdk install maven
```* **MongoDB**: i.e. install using yaourt (archlinux):
```bash
yaourt -S mongodb-bin
```
* **Docker**: i.e. install using yaourt (archlinux):```bash
yaourt -S docker
```### Start API with docker
**Step 1:** Start docker daemon.
```bash
sudo systemctl start docker
```**Step 2:** Start app docker env.
```bash
bash docker-startup
```**Step 3:** Check api info:
```bash
curl "http://localhost:8080/api/navent/info" | python -m json.tool
``````json
{
"build": {
"groupId": "com.navent.api.orders",
"artifactId": "api-orders",
"version": "0.0.1-SNAPSHOT"
}
}
```**Step 4:** Check api health.
```bash
curl "http://localhost:8080/api/navent/health" | python -m json.tool
``````json
{
"status": "UP",
"details": {
"diskSpace": {
"status": "UP",
"details": {
"total": 502996557824,
"free": 248056803328,
"threshold": 10485760
}
},
"mongo": {
"status": "UP",
"details": {
"version": "4.0.0"
}
}
}
}
```**Step 5:** Go to [swagger ui](http://localhost:8080/api/navent/swagger-ui.html) doc to test api-orders.
**Step 6:** Go to [home](http://localhost:8080/api/navent).
### Start API locally
**Step 1:** Start mongodb server.
```bash
sudo systemctl start mongodb
```**Step 2:** Go to mongo console.
```bash
mongo
```**Step 3** Create/switch to orders db.
```bash
use orders
```**Step 4:** Create authentication user use by api-orders to connect to orders db.
```javascript
db.createUser(
{
user: "orders",
pwd: "1234",
roles: [ { role: "readWrite", db: "orders" } ]
}
);
```**Step 5:** Check authentication.
```bash
mongo --port 27017 -u "orders" -p "1234" --authenticationDatabase "orders"
```**Step 6:** Switch to java 8 version.
```bash
sdk use java 8.0.222-amzn
```**Step 7:** Download api-orders.
```bash
git clone https://github.com/adrianmarino/orders.git
cd orders
```**Step 8:** Use localhost mongodb url version under **/src/resources/application.yaml**
```yml
...
data:
mongodb:
uri: "mongodb://orders:1234@mongodb:27017/orders" <--- COMMENT (Docker version)
# uri: "mongodb://orders:1234@localhost:27017/orders" <--- UNCOMMENT (Localhost version)
...
```**Step 9:** Startup api-orders.
```bash
bash startup
```**Step 10:** Check api info:
```bash
curl "http://localhost:8080/api/navent/info" | python -m json.tool
``````json
{
"build": {
"groupId": "com.navent.api.orders",
"artifactId": "api-orders",
"version": "0.0.1-SNAPSHOT"
}
}
```**Step 10:** Check api health.
```bash
curl "http://localhost:8080/api/navent/health" | python -m json.tool
``````json
{
"status": "UP",
"details": {
"diskSpace": {
"status": "UP",
"details": {
"total": 502996557824,
"free": 252307681280,
"threshold": 10485760
}
},
"mongo": {
"status": "UP",
"details": {
"version": "4.0.11"
}
}
}
}
```**Step 11:** Go to [swagger ui](http://localhost:8080/api/navent/swagger-ui.html) doc to test api-orders.
**Step 12:** Go to [home](http://localhost:8080/api/navent).