【发布时间】:2019-12-15 17:28:07
【问题描述】:
在 Meteor 应用程序中,我想要一个在服务器上运行并被客户端调用的密码,所以我想要一个在客户端运行但在服务器端执行其部分代码的 Meteor.method (API 调用)
我无法在 lib 或共享文件夹中导入服务器模块
类似于文档中的这个例子
https://guide.meteor.com/security.html#secret-code
导入 > 服务器 > apicalls.js
export const apicall = function () {}
// Here I want to make my API calls on the server side
共享的>methods.js
import {apicall} from "../imports/server/apicalls.js";
//I want to import the apicall function in a method to run it in the client side
我收到错误
Uncaught Error: Cannot find module ‘…/imports/server/apicalls.js’
【问题讨论】:
标签: javascript meteor