var html2markdown = require('html2markdown');
var fs = require('fs');
var http = require('http');
http.createServer(function(req, res){
fs.readFile('index.html',function (err, data){
if (err) throw new Error(err);
res.writeHead(200, {'Content-Type': 'text/html','Content-Length':data.length});
res.write(html2markdown(data));
res.end();
});
}).listen(8000);
ERROR:
`
L:\github\Java\springmvc-cookbook\cloudstreetmarket-parent\cloudstreetmarket-webapp\src\main\webapp\static\node_modules\html2markdown\markdown_html_parser.js:105
match = html.match( startTag );
^
TypeError: html.match is not a function
at HTMLParser (L:\github\Java\springmvc-cookbook\cloudstreetmarket-parent\cloudstreetmarket-webapp\src\main\webapp\static\node_modules\html2markdown\markdown_html_parser.js:105:19)
at html2markdown (L:\github\Java\springmvc-cookbook\cloudstreetmarket-parent\cloudstreetmarket-webapp\src\main\webapp\static\node_modules\html2markdown\html2markdown.js:197:2)
at module.exports (L:\github\Java\springmvc-cookbook\cloudstreetmarket-parent\cloudstreetmarket-webapp\src\main\webapp\static\node_modules\html2markdown\index.js:7:10)
at L:\github\Java\springmvc-cookbook\cloudstreetmarket-parent\cloudstreetmarket-webapp\src\main\webapp\static\js\html2markdown.js:16:13
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)
ERROR:
` L:\github\Java\springmvc-cookbook\cloudstreetmarket-parent\cloudstreetmarket-webapp\src\main\webapp\static\node_modules\html2markdown\markdown_html_parser.js:105 match = html.match( startTag ); ^
TypeError: html.match is not a function at HTMLParser (L:\github\Java\springmvc-cookbook\cloudstreetmarket-parent\cloudstreetmarket-webapp\src\main\webapp\static\node_modules\html2markdown\markdown_html_parser.js:105:19) at html2markdown (L:\github\Java\springmvc-cookbook\cloudstreetmarket-parent\cloudstreetmarket-webapp\src\main\webapp\static\node_modules\html2markdown\html2markdown.js:197:2) at module.exports (L:\github\Java\springmvc-cookbook\cloudstreetmarket-parent\cloudstreetmarket-webapp\src\main\webapp\static\node_modules\html2markdown\index.js:7:10) at L:\github\Java\springmvc-cookbook\cloudstreetmarket-parent\cloudstreetmarket-webapp\src\main\webapp\static\js\html2markdown.js:16:13 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)
`