Skip to content

Commit

Permalink
incorporate improvement suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
oven committed Apr 11, 2018
1 parent f72b049 commit 82b27aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ $ mvn spring-boot:run
2018-04-11 09:35:49.853 INFO 88567 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms
```

Then, in another window, fetch `http://localhost:8080/api/hello` with curl:
Then, in another window, fetch http://localhost:8080/api/hello with curl or your web browser:

```
$ curl http://localhost:8080/api/hello
Expand All @@ -126,6 +126,10 @@ Hello, the time at the server is now Wed Apr 11 09:38:19 CEST 2018
That's great, we now have a rest service in Spring Boot up and running!

## Adding React

This section uses the tool [npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b),
which is included with newer versions of `npm`.

```
npx create-react-app frontend
Expand Down
17 changes: 7 additions & 10 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@ import './App.css';

class App extends Component {

getHello = () => {
state = {};

componentDidMount() {
setInterval(this.hello, 250);
}

hello = () => {
fetch('/api/hello')
.then(response => response.text())
.then(message => {
this.setState({message: message});
});
};

constructor() {
super();
this.state = {};
}

componentDidMount() {
setInterval(this.getHello, 250);
}

render() {
return (
<div className="App">
Expand Down

0 comments on commit 82b27aa

Please sign in to comment.