Mobrovac has submitted this change and it was merged. Change subject: Update front page to use /api endpoint ......................................................................
Update front page to use /api endpoint * Move front page html from server.js into static/index.html and serve static/ folder. * Modify html to use api/ GET endpoint instead of url/ POST endpoint. Bug: T93518 Change-Id: I9af748f120d8feea80e3011234afedde9605929c --- M server.js A static/index.html 2 files changed, 17 insertions(+), 22 deletions(-) Approvals: Mobrovac: Verified; Looks good to me, approved diff --git a/server.js b/server.js index d3913fc..7f8711f 100644 --- a/server.js +++ b/server.js @@ -52,28 +52,8 @@ app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: false})); -app.use(express.static('api')); //cache api pages - -/* Landing Page */ -app.get('/', function(req, res){ - res.setHeader("Content-Type", "text/html"); - res.send('<!DOCTYPE html>\ -<html>\ - <head>\ - <meta charset="UTF-8">\ - <title>Citoid service</title>\ -</head>\ -<body>\ - <h1>Citoid</h1>\ - <h2><a href="https://www.mediawiki.org/wiki/Citoid" target="_blank">Documentation</a></h2>\ - <h2>Test request</h2>\ - <form action="/url" method="POST">\ - <input type="hidden" name="format" value="mediawiki" />\ - <p>URL: <input name="url" size="100" value="http://link.springer.com/chapter/10.1007/11926078_68" /> <input type="submit" /></p>\ - </form>\ -</body></html>\ - '); -}); +app.use(express.static('api')); // Cache api pages +app.use(express.static(__dirname + '/static')); // Static HTML files /* Endpoint for retrieving citations in JSON format from a URL */ app.post('/url', function(req, res){ diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..3b0f8db --- /dev/null +++ b/static/index.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="UTF-8"> + <title>Citoid service</title> +</head> +<body> + <h1>Citoid</h1> + <h2><a href="https://www.mediawiki.org/wiki/Citoid" target="_blank">Documentation</a></h2> + <h2>Test request</h2> + <form action="/api" method="GET"> + <input type="hidden" name="format" value="mediawiki" /> + <p>URL: <input name="search" size="100" value="http://link.springer.com/chapter/10.1007/11926078_68" /> <input type="submit" /></p> + </form> +</body></html> \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/198555 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9af748f120d8feea80e3011234afedde9605929c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/citoid Gerrit-Branch: master Gerrit-Owner: Mvolz <mv...@wikimedia.org> Gerrit-Reviewer: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Mobrovac <mobro...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits