玉和客户端的JavaScript
我刚开始学习使用jade作为渲染引擎的nodejs的Express,我有意见和路线
这是我的看法
layout.jade
doctype html html head title= title link(rel='stylesheet', href='/stylesheets/style.css') link(href='/themes/bootstrap.min.css', rel='stylesheet') script(src='/javascripts/mygridwidjet.js', type='text/javascript') body block content
index.jade
extends layout block content h1= title p Welcome to #{title} .content-container-fluid .row .cols-sample-area #Grid
这是我的路线
index.js
exports.index = function(req, res){ res.render('index', { title: 'Football Archive' }); };
我写了我的客户端JavaScript与#Grid
交互
现在我真的很困惑在哪里把客户端JavaScript。
ps:我是一个总noob,对不起,如果这个问题是如此愚蠢。
你必须把它放在文件夹public/
(如果它不存在就创build它)
myapp | |-node_modules/ | |-express/ | |-socket.io/ | |-public/ | |-javascripts/ | | |-mygridwidjet.js | |-... | |-server.js
这是一个更复杂的例子(我的应用程序): https : //github.com/CraftYourModCorporation/RedstoneHub
- 如何在nodejs中使用pug-bootstrap模块?
- Node.js / jade – 我如何将mysql数据作为本地variables传递给内联javascript?
- nodejs – jade ReferenceError:进程没有定义
- 如何使用React,Node和Webpack呈现帕格/翡翠模板?
- 如何在Node.js Express应用程序中呈现预编译的Jade(Pug)模板?
- Node.js不能正确parsing外部的javascript
- 使用Socket.io刷新页面上的数据而无需重新加载
- Express / Jade / Pug:调用JavaScript对象的函数
- 如何使用方法放在node.js与快递更新信息