在app.js中我有一个我想从路径文件调用的函数。
当然这是简化的。
app.js
var express = require('express');
var app = express();
var foo = function() {
return 'bar';
}
module.exports = app;
index.js
?
我试图要求(' ../ app.js')并调用app.foo,但这并不起作用。
答案 0 :(得分:3)
如果您要同时导出<Window x:Class="Mackerel_Download_Manager.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:p="clr-namespace:Mackerel_Download_Manager.Properties"
xmlns:util="clr-namespace:Wpf.Util"
Title="Mackerel Download Manager" Height="Auto" Width="Auto" Activated="Window_Activated">
和app
,那么您可以导出一个同时出现的对象
foo
或者,你可以做
module.exports = {
app: app,
foo: foo
}
然后在你的路线
module.exports.app = app;
module.exports.foo = foo;