https://github.com/kevinmichaelchen/spring-react-example
Spring + React
https://github.com/kevinmichaelchen/spring-react-example
Last synced: 10 months ago
JSON representation
Spring + React
- Host: GitHub
- URL: https://github.com/kevinmichaelchen/spring-react-example
- Owner: kevinmichaelchen
- Created: 2016-02-24T04:12:29.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-07T21:18:09.000Z (over 9 years ago)
- Last Synced: 2025-02-23T22:43:40.002Z (10 months ago)
- Language: JavaScript
- Size: 1.81 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
feature1
feature on develop
Forked from [this Spring guide](https://github.com/spring-guides/tut-react-and-spring-data-rest)
...testing... more stuff....
[Good article on Webpack](https://medium.com/@housecor/browserify-vs-webpack-b3d7ca08a0a9#.b1j4p3as7)
To get started run:
```bash
pushd .
npm install webpack -g
cd src/main/resources/static
npm install
webpack
popd
./gradlew bootRun
```
### REST API
#### Tour API
```bash
$ curl localhost:8080/api
{
"_links" : {
"employees" : {
"href" : "http://localhost:8080/api/employees"
},
"profile" : {
"href" : "http://localhost:8080/api/profile"
}
}
}
```
#### List employees
```bash
$ curl localhost:8080/api/employees
{
"_embedded" : {
"employees" : [ {
"firstName" : "Frodo",
"lastName" : "Baggins",
"description" : "ring bearer",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/employees/1"
}
}
} ]
}
}
```
#### View employee detail
```bash
$ curl localhost:8080/api/employees/1
{
"firstName" : "Frodo",
"lastName" : "Baggins",
"description" : "ring bearer",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/employees/1"
}
}
}
```
#### Add employee
```bash
$ curl -X POST localhost:8080/api/employees -d '{"firstName": "Bilbo", "lastName": "Baggins", "description": "burglar"}' -H 'Content-Type:application/json'
{
"firstName" : "Bilbo",
"lastName" : "Baggins",
"description" : "burglar",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/employees/2"
}
}
}
```