Use mdg:validated-method question

dir imports/api/server/users.js
export const userMethods =new ValidatedMethod({…})

but ,in client/templates/page/users.js
use userMethods
Uncaught Error: Cannot find module 'imports/api/server/users.js’

how to import userMethods
import {userMethods} from ‘imports/api/server/users.js’;??

thanks :slight_smile:

Server folder is special directory, which you can read more about in the Meteor Guide. This special folder is not accessible to the client, that’s why you’re getting this error. You need to place your validated methods (which are shared between client/server) outside the server folder to be accessible by he client.

I hope that helps.

thanks :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

1 Like