var serveStatic = require('serve-static') var http = require('http') var fs = require('fs') var Renderer = require('./packages/docsify-server-renderer/build.js') var renderer = new Renderer({ template: ` docsify `, config: { name: 'docsify', repo: 'qingwei-li/docsify', basePath: 'https://docsify.js.org/', loadNavbar: true, loadSidebar: true, subMaxLevel: 3, auto2top: true, alias: { '/de-de/changelog': '/changelog', '/zh-cn/changelog': '/changelog', '/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG' } }, path: './' }) http .createServer(function (req, res) { serveStatic('.')(req, res, function () { // TEST SSR // renderer.renderToString(req.url) // .then(html => res.end(html)) res.writeHead(404, { 'Content-Type': 'text/html' }) res.end(fs.readFileSync('dev.html')) }) }) .listen(3000, '0.0.0.0') console.log(`\nListening at http://0.0.0.0:3000\n`)