I've moved development to the master branch. Not much happening on the dev
branch anymore.
https://github.com/berndsi/service-mobileapp-node
I've made some changes to the structure of the JSON output. Now in addition
to the page content it also provides the data needed for the gallery
feature. That second object is called media[3], and has two arrays: videos
and images[2]. This saves multiple[1] separate requests to the server and
would allow that data to be available for offline usage when the page is
saved.
In the future, we should also add the info needed for the Read more/Read
next section, preferably once we've settled on which way we want it in the
apps. That would save another request to the server, and again would make
offline usage more consistent with online usage.
Next step is to see how we can get this deployed to the experimental
RESTBase stack.
Cheers,
- Bernd
[1] 1 request for gallery collection + 1 per gallery item
[2] in the future there might be also audio
[3] Example media snippet:
[...]
"media": {"videos": [{"url": "
http://upload.wikimedia.org/wikipedia/commons/transcoded/4/45/Play_fight_be…
","width": 1077,"height": 606,"license":
{"name": "cc-by-sa-3.0","url": "
http://creativecommons.org/licenses/by-sa/3.0"}}],"images"ot;images":
[{"url": "
http://upload.wikimedia.org/wikipedia/commons/a/ae/AfricanWildCat.jpg"…
width": 2272,"height": 1704,"license": {"name":
"cc-by-sa-3.0","url": "
http://creativecommons.org/licenses/by-sa/3.0/"}},[...]
On Mon, Mar 2, 2015 at 2:59 PM, Monte Hurd <mhurd(a)wikimedia.org> wrote:
Very cool!!!
On Mar 2, 2015, at 12:56 PM, Bernd Sitzmann <bernd(a)wikimedia.org> wrote:
Hi,
As part of the Node.js prototype spike
<https://trello.com/c/11vVs1El/2-spike-hr-investigate-building-a-node-js-service-for-mobile-apps-content>,
I created a Github repo:
https://github.com/berndsi/service-mobileapp-node/tree/dev
Note that this is the dev branch, where I put the mobileapp specific code
for now. Most info is available in the README. It tells you how to get
started, install the prerequisites, and how to run and use the service. I
also added a troubleshooting section at the end. As mentioned there, I had
to nuke the node_modules folder a few times. Besides that, it went quite
smoothly.
The current version uses mobileview action as the source, and then removes
a few DOM elements (via the domino node module).
It uses the bluebird node module for the promises implementation, which
makes async code nicer.
You can try an example once you have it installed with
http://localhost:6927/en.m.wikipedia.org/v1/mobileapp/lite/cat.
I originally forked
https://github.com/wikimedia/service-template-node
but needed two repos in my Github account, so I can push template changes
upstream, and another to develop the mobileapp code.
Marko and Gabriel from the services team created the template and helped
me getting started. Thank you!
This is just a prototype. So, here's a short list of ideas we could try to
make this more useful for a Mobile Lite app that doesn't require use
WebViews:
* Use Parsoid as mentioned in
https://phabricator.wikimedia.org/T90758#1074382
* Split the "text" objects of each section into paragraph and table objects
* Add some transformations that currently are being done by the apps and
remove some more unneeded data
Cheers,
Bernd
_______________________________________________
Mobile-l mailing list
Mobile-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mobile-l