I would recommend OneJS (http://github.com/azer/onejs) since it's a better
implementation of commonjs and lets you separate your client-side project
as an independent commonjs package. I built multiplayerchess.com using
onejs last year. You may want to take a look at its source code:
http://github.com/azer/multiplayerchess.com
On May 8, 2012 2:05 AM, "Robert Chris Bang Larsen" <[email protected]>
wrote:

> Hi all
>
> I am planning on using Node.js for the server side of multiplayer
> games based on JavaScript and HTML5. I used to use Java for this and
> much code could be shared between client and server, for instance most
> of the game model. A Backgammon client would show the user which moves
> were legal, and the server would verify the legality of a requested
> move, thus they both need a way to enumerate valid moves.
>
> But how can I do this when using Node.js ?
>
> Building a module with 'module.exports' and 'require' will mess up the
> client side, and having just plain JavaScript won't work with Node
> because something will have to be exported from the file (am I
> wrong ?).
>
> So, how would you go about having shared code between Node.js and the
> client side ?
>
> Best,
> Robert
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to