Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with Meteor.js JavaScript Framework - Second Edition

You're reading from   Getting Started with Meteor.js JavaScript Framework - Second Edition Learn to develop powerful web applications in minutes with Meteor

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781785285547
Length 138 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

The client and server folders

Up to this point, we've put all of our JavaScript code in one file: LendLib.js.

Inside LendLib.js, we have two sections that are separated by if statements. The client-facing code is found inside the if (Meteor.isClient) {...} block, and the server-side code is found inside the if (Meteor.isServer) {...} block.

This structure works fine for a very simple application, but when we are writing a more complex application, or we have multiple people working on the same app, trying to share one file with conditional statements will quickly turn into a nightmare situation.

Additionally, Meteor will read any and all files in our application folders and try to apply JavaScript to both the client and the server. This makes for a sort of strange situation if we want to use a client-facing JavaScript library (for example, Twitter Bootstrap or jQuery). If we add the library to the root folder, Meteor will try to implement that file on both the client and the server....

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image