Static Landing Page - Integrate w/ Meteor

I searched high and low on how to integrate a static landing page on a top-level domain (www.domain.com) with a subdomain (app.domain.com). I ended up doing a post form into a picker route. I wanted the user to be able to sign-up and immediately be logged into the app. The form asks for name, e-mail, password.

After I created the account on the server with Accounts.createUser, I grabbed the id and made a route with

response.end('https://app.domain.com/landing/'+userId);

when the page is rendered, it grabs the userId from the route and I use a Meteor.call and on the server I use:

const stampedLoginToken = Accounts._generateStampedLoginToken();
Accounts._insertLoginToken(userId, stampedLoginToken);
return stampedLoginToken;

Then from the result of Meteor.call, I use:

Meteor.loginWithToken(result.token);

This all happens fairly quickly and the user is immediately taken to the dashboard (I have an animation loader just in case the response times are slowed). Is this the best way to do this? Or, should there I do it a different way?

1 Like