https://github.com/ymonnier/docker-restful-java
Simple Restful API with Jersey-Hibernate, AngularJS Client and Websocket Tyrus
https://github.com/ymonnier/docker-restful-java
angularjs database docker docker-compose hibernate java jersey rest-api tyrus websocket
Last synced: 3 months ago
JSON representation
Simple Restful API with Jersey-Hibernate, AngularJS Client and Websocket Tyrus
- Host: GitHub
- URL: https://github.com/ymonnier/docker-restful-java
- Owner: YMonnier
- License: mit
- Created: 2017-01-29T11:12:42.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-03T13:02:58.000Z (about 9 years ago)
- Last Synced: 2024-04-25T07:27:10.169Z (almost 2 years ago)
- Topics: angularjs, database, docker, docker-compose, hibernate, java, jersey, rest-api, tyrus, websocket
- Language: Java
- Homepage:
- Size: 622 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple API Restful Server & AngularsJS Client
Deployment with [Docker](https://www.docker.com).
* Server Restful
* Websocket
* AngularsJS Client
## API Restful
Java project using [Jersey](https://jersey.java.net), [Grizzly](https://grizzly.java.net) and [Hibernate](http://hibernate.org)
#### Authentication
HEADER application/json
| URI path | Resource class | HTTP methods | Notes |
|----------------|--------------------------|--------------|------------------------------------------------------------------------------------------------------|
| /auth/register | AuthenticationController | POST | { "nickname": "string", "address": "string", "password": "string", "role": integer } |
| /auth/login | AuthenticationController | POST | { "nickname": "string", "password":"string"} |
#### Users
HEADER application/json
HEADER authorization
authorization token is given with the `auth/login` action.
| URI path | Resource class | HTTP methods | Notes |
|-------------|-----------------|--------------|---------------------------------------------|
| /users | UsersController | GET | Get all users. |
| /users/{id} | UsersController | GET | Get a specific user depending its ID. |
| /user/{id} | UsersController | PUT | {"nickname": "string", "address": "string"} |
| /users/{id} | UsersController | DELETE | Delete a specific user depending its ID. |
#### Channels
HEADER application/json
HEADER authorization
authorization token is given with the `auth/login` action.
| URI path | Resource class | HTTP methods | Notes |
|------------|--------------------|--------------|------------------------------------------|
| /channels | ChannelsController | GET | Get all channels. |
| /channels | ChannelsController | POST | {"name": "string", "user_id": "integer"} |
## Installation
### With Docker
`docker-compose up -d`
Then run the script shell `run.sh` allowing to change the ip into the **client site** to access to server container from the host.
`./run.sh $(docker-machine ip)` or `./run.sh [your docker bridge ip]`
Now you can test the server access by using `curl`
```
curl -H 'Content-Type: application/json' \
-X POST -d '{"nickname": "YMonnier", "address": "2253–2331 Alder St, Vancouver BC, Canada", "password": "abcd123456", "role": 0}' \
$(docker-machine ip):8080/littleapp/auth/register
Response:
{
"id": 1,
"nickname": "ymonnier",
"password": "$2a$10$ZdU9nA9.efNEFe7X4tjpL.0VA2I5JRdvXi7/DfQMMf4tk1HXvHLOK",
"address": "10 street...",
"token": null,
"channels": [],
"role": 0
}
```
or you can use the client angular...
Run the client: `cd web/ && npm install && bower install && grunt serve` or execute `web/dist/index.html`
Contributor
------------
* [@YMonnier](https://github.com/YMonnier)
License
-------
docker-restful-java is available under the MIT license. See the [LICENSE](https://github.com/YMonnier/docker-restful-java/blob/master/LICENSE) file for more info.