user2683038
user2683038

Reputation: 677

How to embed `diff2html` into a node.js application

I am new to node.js and would like to come up with an application using the diff2html package. Could anybody tell me how a minimalistic implementation could look like (perhaps by completing the code below)?

var http = require('http');
var diff2html = require("diff2html").Diff2Html

http.createServer(function (req, res) {
    // more code here
}).listen(123456);

Upvotes: 0

Views: 539

Answers (1)

Sebastian Waschnick
Sebastian Waschnick

Reputation: 112

There are only two methods, both are described in the documentation.

The lib is for converting a existing diff to html. So there are the two methods getPrettyHtml() and getJsonFromDiff().

I'm not sure what you want to do, but it would be something like:

var http = require('http');
var diff2html = require("diff2html").Diff2Html

http.createServer(function (req, res) {
    diff2html.getPrettyHtml(YOUR_DIFF_FROM_SOMEWHERE, YOUR_OPTIONS);
}).listen(123456);

Upvotes: 0

Related Questions