diff --git a/README.md b/README.md index 63af45d..d432118 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,13 @@ app.get('/', (req, res) => { window.alert('Hello World'); }); +// listen HTTP GET request on API (/api/xxx) +// update page content with response +app.get(/^\/api\//, (req, res, next) => { + document.querySelector('.content').innerHTML = res.responseText; + next(); +}); + // start listening frontend application requests app.listen(); ```