0
# app.get "/example", example.index

# require("./routes/index") app

我知道我的第一行转到名为 example 的控制器并使用 index 函数。我不太确定第二行是做什么的。这个比那个好吗?一个完整的解释将不胜感激。

4

1 回答 1

0

The first line: app.get "/example", example.index says that if someone hits the URL http://localhost:3000/example, then you are loading the example file (presumably required somewhere above) and running the index function on it.

The second line require("./routes/index") app is simply requireing some file called index.coffee in the routes folder and passing app as a variable.

于 2013-03-15T18:35:44.493 回答