From cd94fe18ed0b16d59b0898bd4ca985b07e8effae Mon Sep 17 00:00:00 2001 From: Camel Aissani Date: Sun, 10 Jul 2016 01:34:42 +0200 Subject: [PATCH] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) 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(); ```