mirror of https://github.com/dapr/quickstarts.git
Update README.md for 1.hello-world. (#111)
Update README.md for 1.hello-world to reflect latest version.
This commit is contained in:
parent
dd2381197f
commit
e2696774ab
|
@ -51,10 +51,16 @@ app.post('/neworder', (req, res) => {
|
|||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then((response) => {
|
||||
console.log((response.ok) ? "Successfully persisted state" : "Failed to persist state");
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw "Failed to persist state.";
|
||||
}
|
||||
|
||||
res.status(200).send();
|
||||
console.log("Successfully persisted state.");
|
||||
res.status(200).send();
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
res.status(500).send({message: error});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -79,9 +85,16 @@ We also expose a GET endpoint, `/order`:
|
|||
app.get('/order', (_req, res) => {
|
||||
fetch(`${stateUrl}/order`)
|
||||
.then((response) => {
|
||||
return response.json();
|
||||
if (!response.ok) {
|
||||
throw "Could not get state.";
|
||||
}
|
||||
|
||||
return response.text();
|
||||
}).then((orders) => {
|
||||
res.send(orders);
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
res.status(500).send({message: error});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue