0

I want to add a traditional rest endpoint to my Apollo server and I would like to reuse Meteors authentication system. However, Meteor.user() is not defined in this context. The endpoint will not look or ask for user credentials.

createApolloServer( ... , {
  configServer: (app) => {
    app.use('/myEndpoint', () => {
      /* I want to have a meteor userId here */
    });
  },
});
worldsayshi
  • 1,788
  • 15
  • 31

1 Answers1

0

If you are using Meteor, the best way to make a traditional REST endpoint is:

https://github.com/stubailo/meteor-rest/

simple:json-routes 

and you can do authentication with

simple:rest-accounts-password
simple:authenticate-user-by-token

The best way to get Meteor user information in your resolvers is:

http://dev.apollodata.com/core/meteor.html

Loren
  • 13,903
  • 8
  • 48
  • 79