这是一个例子:
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
});
Run Code Online (Sandbox Code Playgroud)
(等等.)
app.get('/memo', function(req, res) {
console.log("index");
Memo.find({}, function(err, data) {
if(err) return next(err);
res.render('index', { memos: data });
});
});
Run Code Online (Sandbox Code Playgroud)
这是另一个:
app.get('/memo/list', function(req, res, next) {
console.log("get memos");
Memo.find({}, function(err, data) {
if(err) return next(err);
res.json(data);
});
});
Run Code Online (Sandbox Code Playgroud)
这些问题令我困惑:
next/next();
什么?如果它不存在会发生什么?next
作为参数而第一部分不是?编辑:
现在我正在使用surround.vim
HTML文本中的文本,以及根据CSS文件中的十六进制值突出显示文本的插件(例如#888将在CSS文件中具有灰色背景).
是否还有其他有用的Web开发插件?
建议
以下是目前答案中提到的插件列表:
我读过很多文章,谴责过度使用div.我有一种感觉,我可能会在以下标记中这样做:
HTML:
.container {
margin: 0 auto;
overflow: hidden;
width: 960px;
}
/* header */
#header {
background: #EEE;
}
#header h1 {
float: left;
}
#header h2,
#header a,
#header p {
color: #999;
}
#header h1 a {
background: url(../images/logo.png) no-repeat scroll 0 0;
float: left;
height: 30px;
text-indent: -9999px;
width: 500px;
}
#banner {
border-bottom: 1px solid #DDD;
padding: 0 0 15px 0;
margin: 30px 0 30px 0;
overflow: hidden;
width: 960px;
}
#lang {
float: right; …
Run Code Online (Sandbox Code Playgroud) 我在Google上找不到这个答案,因为'on'是一个常见的词.在这个node.js示例中:
conn.on('close', function() {
var pos = connections.indexOf(conn);
if (pos >= 0) {
connections.splice(pos, 1);
}
});
Run Code Online (Sandbox Code Playgroud)
有一种.on
方法(?).它能做什么?这是一种JavaScript方法吗?或者它只是你在节点中找到的东西?我有点困惑,因为我觉得我.on
在jQuery上看到了类似的东西.它与jQuery .live
事件处理程序类似吗?
任何人都可以向我解释这个吗?
我有以下HTML:
<div class="pricing-levels-3">
<p><strong>Which level would you like? (Select 3 Levels)</strong></p>
<input class="single-checkbox"type="checkbox" name="vehicle" value="Bike">Level 1<br>
<input class="single-checkbox" type="checkbox" name="vehicle" value="Bike">Level 2<br>
<input class="single-checkbox" type="checkbox" name="vehicle" value="Bike">Level 3<br>
<input class="single-checkbox" type="checkbox" name="vehicle" value="Bike">Level 4<br>
<input class="single-checkbox" type="checkbox" name="vehicle" value="Bike">Level 5<br>
<input class="single-checkbox" type="checkbox" name="vehicle" value="Bike">Level 6<br>
<input class="single-checkbox" type="checkbox" name="vehicle" value="Bike">Level 7<br>
</div>
Run Code Online (Sandbox Code Playgroud)
直播网站:
http://www.chineselearnonline.com/amember/signup20.php
我怎么能这样做,以便用户只能选择其中3个复选框?
我知道如何在NERDTree中创建重命名,删除和移动文件(只需按下m then either [a, d, or m]
).但我无法弄清楚如何创建一个文件夹.
有人知道如何在NERDTree上做这个(或者只是用vim的本地"方式")?
我按下:启用它们M-x linum-mode
.我怎样才能将其"翻译"到my.emacs文件中,以便每次打开EMACS时自动启用它?
当我这样做:/.html
Vim寻找html
我想,以取代所有.html
与.php
像这样的东西: :%s/html ext/php ext/g