Skip to content
A nifty tool for fetching W3C Web-App Manifests
JavaScript HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
public
.gitignore
CONTRIBUTING.md
LICENSE.md
Procfile
README.md
ROADMAP.md
app.js
app.json
package.json
settings.js
settings_local.js.dist

README.md

FetchManifest

FetchManifest

A nifty tool for fetching metadata from W3C Web-App Manifests.

Try it out now!

Features

  • fetches web-app manifests
  • replaces relative URLs in the manifest with absolute ones (i.e., start_url, src keys)
  • sets CORS headers on manifest responses

Installation

To install from npm:

npm install fetch-manifest

To install the Node dependencies from the git repository:

npm install

Generate a local settings file:

cp settings_local.js{.dist,}

Usage

Here's a basic example of how to use this library in your project:

var manifestFetch = require('manifest-fetch');

fetchManifest.fetchManifest('https://webvr.rocks/').then(function (data) {
  console.log(JSON.stringify(data, null, 2));
}).catch(function (err) {
  console.error(JSON.stringify({error: err.message}, null, 2));
});

To create an HTTP server (using hapi) that serves the fetched manifests:

var manifestFetch = require('manifest-fetch');

fetchManifest.createServer();

To attach the controller routes to an existing hapi server:

var Hapi = require('hapi');
var manifestFetch = require('manifest-fetch');

var myServer = new Hapi.server();

fetchManifest.createServer({
  server: myServer
});

Development

To clone this repo:

git clone git@github.com:cvan/fetch-manifest.git

Serve the site from the simple server:

npm run dev

Then, launch the site from your favourite browser:

http://localhost:3000/

If you wish to serve the site from a different port:

FETCH_MANIFEST_PORT=8000 npm run dev

Deployment

In production, the server is run like so:

NODE_ENV=production node ./app.js

Alternatively:

npm run prod

To run the server à la Heroku:

foreman start web

Contributing

Contributions are very welcome!

License

All code and content within this source-code repository is licensed under the Creative Commons Zero v1.0 Universal license (CC0 1.0 Universal; Public Domain Dedication).

You can copy, modify, distribute, and perform this work, even for commercial purposes, all without asking permission.

For more information, refer to these following links:

You can’t perform that action at this time.