Reputation: 4421
I am wondering if something as basic as client/server operation model is easily doable with Meteor (meteor.com) framework.
A primitive template should
<template name="input">
<div>
<input type="text" val="">
<input type="submit">
</div>
</template>
<template name="output">
<div id="output">
</div>
</template>
wait for input, calls a server to execute serverFunction()
on the input's value, and insert the result into the output tag. No collections, mongo, or authentication required. Of course, every client is supposed to receive its own results. It seems that Meteor.publish()
operates only on collections.
Upvotes: 0
Views: 529
Reputation: 4421
This is what I was looking for:
server:
Meteor.methods =
doStuff: (input) ->
serverFunction input
client:
Template.input.events =
'submit': ->
Meteor.call 'doStuff', $('input[type=text]').val(), (error, result) -›
Session.set 'result', result
Template.output.output = ->
Session.get 'result
Upvotes: 0
Reputation: 4702
Have a look at the Methods section in Meteor documentation: http://docs.meteor.com/#methods_header
"Methods are remote functions that Meteor clients can invoke."
There's also code in the Wordplay example to show how to work this RPC mechanism (see the definition of Meteor.methods({ ... }) in model.js and game.js in this example project for more info).
Upvotes: 1
Reputation: 8406
a Meteor Collection is only associated with a Mongo collection if you tell it to be.. you can also use them to wrap arbitrary data.
The three main benefits of Meteor Collections (for me, at least):
Upvotes: 0