Tag: 咖啡

手写笔不能在Express上使用

我有一个在Express服务器上使用Nib和Stylus的项目,经过一些更改后,从.styl到.css的编译过程不再有效,我正在查阅Nib,Stylus和Express的文档,但找不到因为我的代码,文件目录和设置似乎没问题。 但仍然不编译。 码: express = require("express") coffee = require("coffee-script") stylus = require("stylus") jade = require("jade") nib = require("nib") app = express.createServer() port = process.env.PORT || 3000 app.use app.router app.use express.methodOverride() app.use express.bodyParser() app.set "views", __dirname + "/views" app.set "view engine", "jade" app.use stylus.middleware( src: __dirname + "/src" dest: __dirname + "/public" compile: (str, path) -> […]

伊斯坦堡代码覆盖与摩卡咖啡testing与咖啡的脚本

我正在使用摩卡来运行纯粹在coffeescript中的testing。 我也希望能够使用伊斯坦布尔来生成代码覆盖率报告。 请注意,我在mocha.opts文件中使用了mocha选项–compilers coffee:coffee-script/register 。 我遇到的问题是,不包括需要其他coffeescript源文件的testing。 如果相反,我需要js文件,它覆盖的很好。 我错过了什么吗? 我的npm test命令是: istanbul test –report html -x 'vendor/**' _mocha 。 我使用npm test –coverage来执行伊斯坦布尔的覆盖实用程序。 下面是一个摩卡testing(./test/test.coffee)的示例: # Project # require ../src/main.coffee main = require('../src/main') # Chai chai = require('chai') assert = chai.assert should = chai.should() expect = chai.expect describe 'something', (done) -> describe "when given something", -> it "should […]

从快递中间件中排除路由

我有一个节点应用程序坐在像其他微服务面前的防火墙/调度程序,它使用如下所示的中间件链: … app.use app_lookup app.use timestamp_validator app.use request_body app.use checksum_validator app.use rateLimiter app.use whitelist app.use proxy … 但是对于特定的GET路由,我想跳过除rateLimiter和proxy之外的所有路由。 他们的方式来设置一个像Rails before_filterfilter使用:except /:only?