我想要向我的Apollo服务器添加一个传统的rest端点,并且我想重用Meteors身份验证系统。但是,在此上下文中没有定义Meteor.user()。端点将不会查找或询问用户凭据。
createApolloServer( ... , {
configServer: (app) => {
app.use('/myEndpoint', () => {
/* I want to have a meteor userId here */
});
},
});发布于 2017-02-03 10:15:34
如果您使用的是Meteor,创建传统REST端点的最佳方法是:
https://github.com/stubailo/meteor-rest/
simple:json-routes 您可以使用以下命令进行身份验证
simple:rest-accounts-password
simple:authenticate-user-by-token在解析器中获取Meteor用户信息的最佳方法是:
http://dev.apollodata.com/core/meteor.html
https://stackoverflow.com/questions/41980917
复制相似问题