Wikimedia Apps/Team/RESTBase services for apps/Notes

Routes
All routes start with {domain}/[...]v1/page:

Not actively developed

 * (pure HTML, going away)
 * (for Lite app)

Local dev environment
http://localhost:6927/en.wikipedia.org/v1/page/mobile-html-sections/Munich

http://localhost:6927/en.wikipedia.org/v1/page/mobile-html-sections-lead/Munich

http://localhost:6927/en.wikipedia.org/v1/page/mobile-html-sections-remaining/Munich

Labs (mobileapps.wmflabs.org)
(Updated when code gets merged)

http://mobileapps.wmflabs.org/en.wikipedia.org/v1/page/mobile-html-sections/Munich

http://mobileapps.wmflabs.org/en.wikipedia.org/v1/page/mobile-html-sections-lead/Munich

http://mobileapps.wmflabs.org/en.wikipedia.org/v1/page/mobile-html-sections-remaining/Munich

Production (Service Cluster B)
(Deployment windows on Monday/Wednesday at 1:00PM PT.) Using RESTBase infrastructure. Docs.

https://en.wikipedia.org/api/rest_v1/page/mobile-html-sections/Munich

https://en.wikipedia.org/api/rest_v1/page/mobile-html-sections-lead/Munich

https://en.wikipedia.org/api/rest_v1/page/mobile-html-sections-remaining/Munich

Response format / Content

 * sections[] split between  +
 * changed/extra properties in  response:
 * lead image
 * first infobox as JSON object,
 * text extracts,
 * pronunciation,
 * spokenWikipedia,
 * geo,
 * media {images, videos}
 * : should we have a mobile-preview route?

Architecture/Data Flow
RESTBase is the infrastructure which is hosting our Node.js service. Parallel requests to backend services:
 * action=mobileview
 * parsoid (soon)
 * gen=images -> prop=imageinfo | prop=videoinfo
 * extract

Development/Nodejs

 * Started with Marko's project template.
 * Node.js service, Express app
 * Parallel requests to backend services via Promises

Important commands
npm install npm start npm test npm run-script coverage rm -rf node_modules

Files/folders of note

 * spec.yaml (Swagger spec, x-amples)
 * app.js (initApp, loadRoutes, createServer)
 * routes/mobile-html-sections.js (version 1, routes, promises)
 * lib/transforms.js (domino)
 * lib/mwapi.js
 * test/mobile-html-sections/pagecontent.js (describe.only)

Edit/debug
IntelliJ + Node.js plugin (WebStorm), any editor with JS syntax highlighting would do just fine

Use a lot of  for debugging (sometimes with   or pretty  ). Can't use  for DOM elements due to the circular nature of DOM. is not a ton of help but may be a start.

Enable it from the app / roll-out to Android Beta app
In App: Settings > Developer options >

Node.js service developers also change  to point to their dev machines.