Best practices for managing client method stubs and server methods?


#1

When I’m doing optimistic UI with client method stubs, should I be organizing my methods like

client/methods.js
server/methods.js

or like

  1. lib/methods.js

(2) saves me time in writing code since most of the operations would be nearly identical (mostly just need to check for client/server to determine if I should use Meteor.userId()/this.userId, respectively. The methods would already be defined on client and server already.

I get the feeling I’m not seeing something with (1). What would the benefits of doing it like (1) be? I’d basically be doubling the lines of code required.

What are the best practices in handling client method stubs?


#2

I also like an answer to this


#3

This is how to official meteor todos app does it