在express中追加urlpath

我正在使用freeboard.iobuild立干舷。 我使用express在节点服务器上运行它。 我用

router.get('/', function(req, res, next) { res.sendFile(path.join(__dirname + '/index.html')); }); 

当基础路线被击中时发送干舷html文件。 不过,为了使freeboard加载我保存的仪表板,我需要将#source = dashboard.json附加到url。 所以最后的url看起来像

 http://localhost:8080/#source=dashboard.json 

有什么办法,我可以做到这一点使用快递? 当我打localhost时:8080 /我想附加到URLpath#source = dashboard.json,并用index.html文件响应。 谢谢!

浏览器不会将URL的片段发送到服务器。 在这里看到更多的信息。 因此,对于服务器,即使用户在URL字段中input片段,该片段也会一直丢失。 在这种情况下,将浏览器redirect到包含片段的相同URL可能是错误的。

Interesting Posts