koramaiku
koramaiku

Reputation: 358

Best Practice for separating Meteor app into 2 sections, one for a landing and the actual app for users logged in

I have a webapp and I am currently using Meteor.js to develop and I understand it has a single page app pattern to it. Now my app has 2 separate sections where one is the landing for users not logged in and the other is for users logged in where they can actually access the app. Kind of like Asana where their domain links to a landing section for users not logged in and the app.asana.com for users that have logged in and can access the app and its functionalities.

I am thinking of putting these into 2 separate meteor instances, unless if that is really a bad idea.

What is a better way to do this with meteor?

Thanks.

Upvotes: 1

Views: 199

Answers (1)

Martin
Martin

Reputation: 558

I don't think the two instances approach is a very good idea.

The flow you describe above could be achieved by simply using templates, where you render one part if the user is logged in and another part if the user isn't logged in:

<body>
  {{#if currentUser}}
    {{> userIsLoggedInTemplate}}
  {{else}}
    {{> userIsNotLoggedInTemplate}}
  {{/ if}}
</body>

The {{#if currentUser}} is described here: http://docs.meteor.com/#template_currentuser

For inspiration take a look at the examples that are provided on the meteor homepage.

Another approach you could choose to follow could be to add a Router - more info here (net.tutsplus.com)

Upvotes: 1

Related Questions