Writing apps should be fun. This is a statement I try to keep in mind when approaching any application development. When I first realized that a full stack of Javascript can be used to create an application I was very happy, since for me coding in Javascript is a lot of fun. I was soon quite eager to neglect the traditional Java server-side + Javascript client, giving up the Java server side "bliss" and the constant context switching, in favor of a full stack of Javascript whenever I could.
For the past 2+ years I have been developing a variety of applications using a pure JS stack: Games, Forex trading middleware, CRM, CMS, sophisticated proxies, and various utilities. I must admit my productivity has increased dramatically and the time-to-market of each and every project was a fraction of what it would have been using traditional Java based server side infra-structure.
On October 29th 2013 I gave a talk at the "Javascript.everywhere" meetup event, in which I presented the development route of Youtube Remote Control Application with a "slave" player using Javascript stack all over (NodeJS, Socket.IO, ExpressJS, AngularJS, MongoDB). I'm pleased to share the presentation
- See more at: http://www.tikalk.com/js/writing-fullstack-application-javascript#sthash.IjFNbQJ2.dpuf
9. Getting Started
• First Flow - Search Youtube
• Steps:
1. Basic client view with search box
2. Server “search” API
3. Youtube micro service
4. Display results on client
30. The “Playlist“ service
• The data structure:
• Playlists “Table” (AKA Collection):
{
_id: user-id,
name: playlist-name,
media: [{mediaType: media-type, mediaId: XX}]
}
31. Introducing: MongoDB
• Document based NoSQL database
• Very easy to get started
• Uses Javascript internally for
operations such as Map/Reduce
• Shell is based on V8 engine – runs js
files.
• Good hosted solutions (with free tier)
32. Adding MongoDB
• My favorite: MongoJS
– hIps://github.com/mafintosh/mongojs
– Uses same syntax as the mongo-cli
– Wraps the native driver
36. Tips and Tricks
• Keep the server
stateless
• Consider cloud
(managed) Solutions:
– AppFog
– Nodejitsu,
– Heroku
– MongoHQ,
– MongoLab,
– AWS
• Use a Node process
per core
• Use a Load Balancing
proxy
• Nginx & HAProxy
support WebSocket
37. Conclusion
Javascript based applications are :
– Easy to set up
– Easy to enhance (feature iterations)
– Easy to scale (out & up)
– Feature rich
– Easy to deploy
– Most important: It’s Fun!