Let's say I have a file called app.js.
(假设我有一个名为app.js的文件。)
Pretty simple: (很简单:)
var express = require('express');
var app = express.createServer();
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.get('/', function(req, res){
res.render('index', {locals: {
title: 'NowJS + Express Example'
}});
});
app.listen(8080);
What if I have a functions inside "tools.js".
(如果我在“ tools.js”中有一个函数,该怎么办。)
How would I import them to use in apps.js? (如何导入它们以在apps.js中使用?)
Or...am I supposed to turn "tools" into a module, and then require it?
(或者...我应该把“工具”变成一个模块,然后需要它吗?)
<< seems hard, I rather do the basic import of the tools.js file. (<<似乎很难,我宁愿对tools.js文件进行基本导入。)
ask by TIMEX translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…