PDF Full Stack JavaScript 1st Edition Azat Mardan download
PDF Full Stack JavaScript 1st Edition Azat Mardan download
com
https://ebookmeta.com/product/full-stack-javascript-1st-
edition-azat-mardan/
OR CLICK BUTTON
DOWNLOAD NOW
https://ebookmeta.com/product/full-stack-javascript-learn-backbone-js-
node-js-and-mongodb-second-edition-azat-mardan/
ebookmeta.com
https://ebookmeta.com/product/100-typescript-mistakes-and-how-to-
avoid-them-meap-v01-azat-mardan/
ebookmeta.com
https://ebookmeta.com/product/full-stack-graphql-applications-1st-
edition-william-lyon/
ebookmeta.com
https://ebookmeta.com/product/the-routledge-companion-to-photography-
representation-and-social-justice-1st-edition-moritz-neumuller-editor/
ebookmeta.com
Who Owns Knowledge Knowledge and the Law 1st Edition Nico
Stehr Bernd Weiler
https://ebookmeta.com/product/who-owns-knowledge-knowledge-and-the-
law-1st-edition-nico-stehr-bernd-weiler/
ebookmeta.com
https://ebookmeta.com/product/writing-by-choice-3rd-edition-eric-
henderson/
ebookmeta.com
https://ebookmeta.com/product/insight-guides-japan-travel-guide-
ebook-7th-edition-insight-guides/
ebookmeta.com
https://ebookmeta.com/product/lonely-planet-jordan-11th-edition-
lonely-planet/
ebookmeta.com
https://ebookmeta.com/product/zero-to-production-in-rust-an-
opinionated-introduction-to-backend-development-2022nd-edition-luca-
palmieri/
ebookmeta.com
Desserts for Stressed People 1st Edition Letizia Lorini
https://ebookmeta.com/product/desserts-for-stressed-people-1st-
edition-letizia-lorini/
ebookmeta.com
T HE E X P ER T ’S VOIC E ®
Full Stack
JavaScript
Learn Backbone.js,
Node.js and MongoDB
—
Azat Mardan
www.allitebooks.com
Full Stack
JavaScript
Learn Backbone.js, Node.js
and MongoDB
Second Edition
Azat Mardan
www.allitebooks.com
Full Stack JavaScript: Learn Backbone.js, Node.js and MongoDB
Copyright © 2015 by Azat Mardan
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part
of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission
or information storage and retrieval, electronic adaptation, computer software, or by similar or
dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are
brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for
the purpose of being entered and executed on a computer system, for exclusive use by the purchaser
of the work. Duplication of this publication or parts thereof is permitted only under the provisions
of the Copyright Law of the Publisher’s location, in its current version, and permission for use must
always be obtained from Springer. Permissions for use may be obtained through RightsLink at the
Copyright Clearance Center. Violations are liable to prosecution under the respective Copyright Law.
ISBN-13 (pbk): 978-1-4842-1750-4
ISBN-13 (electronic): 978-1-4842-1751-1
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and
images only in an editorial fashion and to the benefit of the trademark owner, with no intention of
infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they
are not identified as such, is not to be taken as an expression of opinion as to whether or not they are
subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal responsibility
for any errors or omissions that may be made. The publisher makes no warranty, express or implied,
with respect to the material contained herein.
www.allitebooks.com
To my parents, Almas and Alsu, who bought me my first computer, and
let me use the phone line for dial-up Internet
www.allitebooks.com
Contents at a Glance
■
■Chapter 1: Basics��������������������������������������������������������������������������� 1
■
■Chapter 2: Setup��������������������������������������������������������������������������� 21
■
■Chapter 3: jQuery and Parse.com������������������������������������������������� 43
■
■Chapter 4: Intro to Backbone.js���������������������������������������������������� 79
■
■Chapter 5: Backbone.js and Parse.com�������������������������������������� 121
■
■Chapter 6: Intro to Node.js��������������������������������������������������������� 137
■
■Chapter 7: Intro to MongoDB������������������������������������������������������ 155
■
■Chapter 8: Putting It All Together����������������������������������������������� 167
■
■Appendix A: Conclusion and Further Reading���������������������������� 187
Index���������������������������������������������������������������������������������������������� 193
www.allitebooks.com
Contents
■
■Chapter 1: Basics��������������������������������������������������������������������������� 1
Front-End Definitions������������������������������������������������������������������������������ 1
Web Request Cycle��������������������������������������������������������������������������������������������������� 2
Mobile Development������������������������������������������������������������������������������������������������� 3
HyperText Markup Language������������������������������������������������������������������������������������ 4
Cascading Style Sheets�������������������������������������������������������������������������������������������� 6
JavaScript����������������������������������������������������������������������������������������������������������������� 7
Agile Methodologies������������������������������������������������������������������������������ 13
Scrum��������������������������������������������������������������������������������������������������������������������� 13
Test-Driven Development��������������������������������������������������������������������������������������� 14
Continuous Deployment and Integration���������������������������������������������������������������� 14
Pair Programming��������������������������������������������������������������������������������������������������� 15
Back-End Definitions����������������������������������������������������������������������������� 15
Node.js�������������������������������������������������������������������������������������������������������������������� 15
NoSQL and MongoDB��������������������������������������������������������������������������������������������� 16
Cloud Computing���������������������������������������������������������������������������������������������������� 16
vii
www.allitebooks.com
■ Contents
Summary����������������������������������������������������������������������������������������������� 19
■
■Chapter 2: Setup��������������������������������������������������������������������������� 21
Local Setup������������������������������������������������������������������������������������������� 21
Development Folder����������������������������������������������������������������������������������������������� 22
Browsers���������������������������������������������������������������������������������������������������������������� 23
IDEs and Text Editors���������������������������������������������������������������������������������������������� 25
Version Control Systems����������������������������������������������������������������������������������������� 26
Cloud Setup������������������������������������������������������������������������������������������� 36
SSH Keys���������������������������������������������������������������������������������������������������������������� 36
GitHub��������������������������������������������������������������������������������������������������������������������� 37
Windows Azure������������������������������������������������������������������������������������������������������� 38
Heroku�������������������������������������������������������������������������������������������������������������������� 40
Summary����������������������������������������������������������������������������������������������� 41
■
■Chapter 3: jQuery and Parse.com������������������������������������������������� 43
Definitions��������������������������������������������������������������������������������������������� 44
JavaScript Object Notation������������������������������������������������������������������������������������� 44
AJAX����������������������������������������������������������������������������������������������������������������������� 45
Cross-Domain Calls������������������������������������������������������������������������������������������������ 45
jQuery Functions����������������������������������������������������������������������������������� 46
Twitter Bootstrap����������������������������������������������������������������������������������� 47
viii
www.allitebooks.com
■ Contents
LESS������������������������������������������������������������������������������������������������������ 50
LESS Variables�������������������������������������������������������������������������������������������������������� 51
LESS Mix-ins���������������������������������������������������������������������������������������������������������� 52
LESS Operations����������������������������������������������������������������������������������������������������� 53
ix
www.allitebooks.com
■ Contents
■
■Chapter 5: Backbone.js and Parse.com�������������������������������������� 121
Message Board with Parse.com: JavaScript SDK and
Backbone.js Version���������������������������������������������������������������������������� 121
Taking Message Board Further����������������������������������������������������������� 134
Summary��������������������������������������������������������������������������������������������� 135
■
■Chapter 6: Intro to Node.js��������������������������������������������������������� 137
Building “Hello World” in Node.js�������������������������������������������������������� 137
Node.js Core Modules�������������������������������������������������������������������������� 139
http����������������������������������������������������������������������������������������������������������������������� 139
util������������������������������������������������������������������������������������������������������������������������ 140
querystring����������������������������������������������������������������������������������������������������������� 140
url������������������������������������������������������������������������������������������������������������������������� 140
fs��������������������������������������������������������������������������������������������������������������������������� 140
npm Node Package Manager������������������������������������������������������������������������������� 141
www.allitebooks.com
■ Contents
■
■Chapter 8: Putting It All Together����������������������������������������������� 167
Adding CORS for Different Domain Deployment���������������������������������� 168
Message Board UI������������������������������������������������������������������������������� 169
Message Board API����������������������������������������������������������������������������� 174
Deployment to Heroku������������������������������������������������������������������������� 178
Same Domain Deployment Server������������������������������������������������������ 179
Deployment to Amazon Web Services������������������������������������������������� 182
Summary��������������������������������������������������������������������������������������������� 185
■
■Appendix A: Conclusion and Further Reading���������������������������� 187
Conclusion������������������������������������������������������������������������������������������� 187
Further Reading����������������������������������������������������������������������������������� 188
JavaScript Resources and Free E-Books�������������������������������������������������������������� 188
JavaScript Books�������������������������������������������������������������������������������������������������� 189
Node.js Resources and Free E-Books������������������������������������������������������������������� 190
Node.js Books������������������������������������������������������������������������������������������������������� 190
Interactive Online Classes and Courses��������������������������������������������������������������� 191
Startup Books and Blogs�������������������������������������������������������������������������������������� 191
Index���������������������������������������������������������������������������������������������� 193
xi
www.allitebooks.com
About the Author
xiii
■ About the Author
Azat is also the author of Pro Express.js, Practical Node.js and Node Program, and
others. Azat is the creator of open source Node.js projects, including ExpressWorks,
mongoui, and HackHall.
You can reach Azat and say hi using one of these methods:
Twitter: [@azat_co](https://twitter.com/azat_co) - Azat loves getting "Hi" on
Twitter
Facebook
Blog: webapplog.com
GitHub: github.com/azat-co/fullstack-javascript
Share on Twitter
Tweet “I’m starting FullStack JavaScript by @azat_co @Apress ” by opening this link
http://ctt.ec/he3Ug.
xiv
Acknowledgments
I would like to thank the team of early Node contributors bringing JavaScript to the
servers. Without them, the full stack JavaScript development wouldn’t be possible.
I’m grateful to my copy and content editors at Apress specifially to James Markham,
Mark Powers, Teresa Horton, and Karen Jameson. They accomplished an amazing feat by
bringing this book to life in a span of a few weeks.
Also, I’m grateful to the students of Hack Reactor, Marakana, pariSOMA, and General
Assembly where I taught and used early Full Stack JavaScript (or its parts) training
material.
xv
Preface
I’m writing this as I’m sitting at the San Francisco airport waiting for my flight to Portland,
Oregon, for the biggest Node.js conference. I’ll be speaking there about Node.js. It’s scary
and funny at the same time to think that I started to learn Node only three years ago. Yes,
I remember how I decided that the best way to learn is to teach others. For this reason
I started teaching my first Node classes and writing this book. The book was mostly for
me, so I could remember how to push Heroku or how to create Node servers that talk to
MongoDB. It was called Rapid Prototyping with JS back then. Three years sped away; I
published a few more Node books as well as released several Node apps in production;
and a few months ago Apress approached me wanting to publish an updated edition
under a new title.
The main reason I bet my time and energy on JavaScript and Node in the first place
is that I felt both intuitively and logically the potential of the full stack JavaScript. The one
language to rule the whole stack across all the layers. Logically I understood the code
reuse, expressiveness, and performance advantages of Node.js and the ever-increasing
importance of front-end development with MVC-like frameworks such as Backbone.
Intuitively, I just freaking fell in love with JavaScript both on the browser and on the
server.
Yes, I used JavaScript for many years but it was more pain than fun. Not anymore.
I was able to get a sense of what’s going on at the front end while at the same time getting
all the power and flexibility on the server. My brain started to think 5, maybe 10 times
faster than before because I started to remember all the obscure methods from Array or
String objects. I stopped having Mozilla Developer Network or Google open next to my
code editor. And what a relief when you don’t need to wait for the compiler each time that
you want to test something really quickly.
The airline crew announced my boarding. I need to get on the plane, but I hope this
easy, beginner-friendly manual will open the world of full stack JavaScript and cloud
computing. Jump on the train of this amazing technology with me.
xvii
Introduction
xix
Other documents randomly have
different content
Poems & Ballads. Third Series. Cr. 8vo, 7s.
Songs before Sunrise. Crown 8vo, 10s. 6d.
Bothwell: A Tragedy. Crown 8vo, 12s. 6d.
Songs of Two Nations. Crown 8vo, 6s.
George Chapman. (See Vol. II. of G. Chapman’s Works.) Crown
8vo, 3s. 6d.
Essays and Studies. Crown 8vo, 12s.
Erechtheus: A Tragedy. Crown 8vo, 6s.
A Note on Charlotte Bronte. Cr. 8vo, 6s.
A Study of Shakespeare. Crown 8vo, 8s.
Songs of the Springtides. Crown 8vo, 6s.
Studies in Song. Crown 8vo, 7s.
Mary Stuart: A Tragedy. Crown 8vo, 8s.
Tristram of Lyonesse. Crown 8vo, 9s.
A Century of Roundels. Small 4to, 8s.
A Midsummer Holiday. Crown 8vo, 7s.
Marino Faliero: A Tragedy. Crown 8vo, 6s.
A Study of Victor Hugo. Crown 8vo, 6s.
Miscellanies. Crown 8vo, 12s.
Locrine: A Tragedy. Crown 8vo, 6s.
A Study of Ben Jonson. Crown 8vo, 7s.
The Sisters: A Tragedy. Crown 8vo, 6s.
Astrophel, &c. Crown 8vo, 7s.
Studies in Prose and Poetry. Cr. 8vo, 9s.
The Tale of Balen. Crown 8vo, 7s.
Rosamund: A Play. Crown 8vo, 6s.
Timbs (John), Works by. Crown 8vo, cloth, 3s. 6d. each.
Clubs and Club Life in London: Anecdotes of its Famous
Coffee-houses, Hostelries, and Taverns. With 41 Illustrations.
English Eccentrics and Eccentricities: Stories of Delusions,
Impostures, Sporting Scenes, Eccentric Artists, Theatrical
Folk, &c. With 48 Illustrations.
Trollope (T. A.).—Diamond Cut Diamond. Post 8vo, illust. bds., 2s.
Trowbridge (J. T.).—Farnell’s Folly. Post 8vo, illust. boards, 2s.
Crown 8vo, cloth extra, 3s. 6d. each; post 8vo, picture boards, 2s. each.
A Tramp Abroad. With 314 Illustrations.
The Innocents Abroad; or, The New Pilgrim’s Progress. With
234 Illustrations. (The Two Shilling Edition is entitled Mark
Twain’s Pleasure Trip.)
The Gilded Age. By Mark Twain and C. D. Warner. With 212
Illustrations.
The Adventures of Tom Sawyer. With 111 Illustrations.
The Prince and the Pauper. With 190 Illustrations.
Life on the Mississippi. With 300 Illustrations.
The Adventures of Huckleberry Finn. With 174 Illustrations by
E. W. Kemble.
A Yankee at the Court of King Arthur. With 220 Illustrations by
Dan Beard.
The Stolen White Elephant.
The £1,000,000 Bank-Note.
Crown 8vo, cloth, 3s. 6d. each; post 8vo, picture boards, 2s. each.
The Queen Against Owen.
The Prince of Balkistan.
‘God Save the Queen!’ a Tale of ’37. Crown 8vo, decorated cover,
1s.; cloth, 2s.
Vashti and Esther. By ‘Belle’ of The World. Cr. 8vo, cloth, 3s. 6d.
Vizetelly (Ernest A.), Books by. Crown 8vo, cloth, 3s. 6d. each.
The Scorpion: A Romance of Spain. With a Frontispiece.
With Zola in England: A Story of Exile. With 4 Portraits.
Waller (S. E.).—Sebastiani’s Secret. With 9 Illusts. Cr. 8vo, cl., 6s.
Walton and Cotton’s Complete Angler; or, The Contemplative
Man’s Recreation, by Izaak Walton; and Instructions How to
Angle, for a Trout or Grayling in a clear Stream, by Charles
Cotton. With Memoirs and Notes by Sir Harris Nicolas, and 61
Illustrations. Crown 8vo, cloth antique, 7s. 6d.
Winter (John Strange), Stories by. Post 8vo, illustrated boards, 2s. each;
cloth limp, 2s. 6d. each.
Cavalry Life.
Regimental Legends.
Cavalry Life and Regimental Legends. Library Edition, set in
new type and handsomely bound. Crown 8vo, cloth, 3s. 6d.
A Soldier’s Children. With 34 Illustrations by E. G. Thomson
and E. Stuart Hardy. Crown 8vo, cloth extra, 3s. 6d.
Handy Novels.
Fcap. 8vo, cloth boards, 1s. 6d. each.
A Lost Soul. By W. L. Alden.
Dr. Palliser’s Patient. By Grant Allen.
Monte Carlo Stories. By Joan Barrett.
Black Spirits and White. By R. A. Cram.
Seven Sleepers of Ephesus. M. E. Coleridge.
Taken from the Enemy. By H. Newbolt.
The Old Maid’s Sweetheart. By A. St. Aubyn.
Modest Little Sara. By Alan St. Aubyn.
My Library.
Printed on laid paper, post 8vo, half-Roxburghe, 2s. 6d. each.
The Journal of Maurice de Guerin.
The Dramatic Essays of Charles Lamb.
Citation and Examination of William Shakspeare. By W. S.
Landor.
Christie Johnstone. By Charles Reade.
Peg Woffington. By Charles Reade.
By F. M. ALLEN.—Green as Grass.
By GRANT ALLEN.
Philistia.
Babylon.
Strange Stories.
For Maimie’s Sake.
In all Shades.
The Beckoning Hand.
The Devil’s Die.
This Mortal Coil.
The Tents of Shem.
The Great Taboo.
Dumaresq’s Daughter.
Duchess of Powysland.
Blood Royal.
I. Greet’s Masterpiece.
The Scallywag.
At Market Value.
Under Sealed Orders.
By M. ANDERSON.—Othello’s Occupation.
By EDWIN L. ARNOLD.
Phra the Phœnician.
Constable of St. Nicholas.
By ROBERT BARR.
In a Steamer Chair.
From Whose Bourne.
A Woman Intervenes.
Revenge!
By FRANK BARRETT.
The Woman of the Iron Bracelets.
The Harding Scandal.
Under a Strange Mask.
A Missing Witness.
Was She Justified?