普通网友 2014-04-19 22:42
浏览 81

用Martini显示HTML,CSS和Javascript

I'm trying to build a chatroom using Martini.

I put together some HTML, CSS and JS using Bootstrap, and now I want to display it using Martini. I'm able to display a "Hello world" index.html file without much trouble, but when I replace index.html file with the code I want it to render (the chat room layout), it tries calling the js/ and css/ files using GET requests and fails.

Specifically, this is the output :

[martini] listening on :3000
[martini] Started GET /
[martini] Completed 200 OK in 570.573us
[martini] Started GET /index.html
[martini] Completed 200 OK in 1.188084ms
[martini] Started GET /js/chatclient.js
[martini] Completed 404 Not Found in 614.137us
[martini] Started GET /js/bootstrap.min.js
[martini] Completed 404 Not Found in 417.855us
[martini] Started GET /css/bootstrap.min.css
[martini] Completed 404 Not Found in 440.463us

Any advice on how I can get the Javascript to work? From a simple Google search I couldn't find anything regarding being able to render CSS and JS using Martini, which is why I posted here.

  • 写回答

1条回答 默认 最新

  • dsyrdwdbo47282676 2014-04-19 22:57
    关注

    Never mind, got it -

    Its a simple

    m.Use(martini.Static(<path to assets>))
    
    评论

报告相同问题?

悬赏问题

  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了