node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป



Module for working with web links as described in rfc2616

var linking = require('../lib/main.js');
var httpheaderlinking = linking.httpheader;

var str = '<>; rel="previous"; title="previous chapter"'

//Parse from string into json
var parsed = httpheaderlinking.parse(str);    	

//Stringify from json into string
var str2   = httpheaderlinking.stringify(parsed);   

//Now str = str2

//Parse from a http request header into json
	var parsed = httpheaderlinking.parseRequest(req);    	

//Set from json into a http request header
	 var link = [
            href: '',
            rel: 'previous',
            title: 'previous chapter'
     httpheaderlinking.setToResponse(res, link);