Mementoweb.js
This is an express 4.X routing plugin to easily add Memento Datetime versioning to your application. It is an implementation of RFC7098.
Install mementoweb.js via npm
npm install mementoweb
Create a simple application by specifying which Datetime Negotiation pattern you want to use (2.1 is default).
var express = require('express'),
memento = require('mementoweb');
var app = express();
var memento = memento(app,{pattern:21});
Create routes as with any other express application
app.get('/hello', function(req, res){
res.send('Hello World');
});
var server = app.listen(3000, function() {
console.log('Listening on port %d', server.address().port);
});
The resources /hello?memento=timegate
, /hello?memento=timemap
, /hello?memento={version}
will be automatically available, together with the required hypermedia.