How can I set and get cookies (server side) in Meteor?
It looks like we got a solution: ostrio/cookies which work both on the server side and on the client side: https://atmospherejs.com/ostrio/cookies
import { Cookies } from 'meteor/ostrio:cookies';
const cookies = new Cookies();
const oldValue = cookies.get("key");
cookies.set("key", "newValue");
Meteor does not currently have a supported way to use cookies on the server.
You can use cookies on the client, though. Here's a snippet to show a splash screen the first time the user visits a page:
Meteor.startup(function () {
if (!document.cookie.match("splash="))
$('body').append(Meteor.ui.render(Template.splash));
});
Template.splash.events = {
'click .submit': function () {
document.cookie = "splash=ack;expires=Sat, 23 Mar 2013 00:00:0 GMT";
$('#splash_outer').remove();
}
};
You could use a similar approach and set the cookies in client side code, then send the results to the server in a method call.