starting from scratch with the mean stack
TRANSCRIPT
2
Who We Are
Sruti Cheedalla:Senior Web Developer
Kat Styons: Web Developer
Matt Cwalinski: Senior Web Developer
4
Agenda
IntroductionSruti Cheedalla
Building with the MEAN StackKat Styons
What’s Next?Matt Cwalinski
29
● Universal end-to-end Workflow
● Focus on speed of development
● Flexible pieces
Value of the MEAN Stack
32
● Universal end-to-end Workflow
● Focus on speed of development
● Flexible pieces
Value of the MEAN Stack
R
37
What we’ll cover
• Using MongoDB in our project– NodeJS and MongooseJS
• Life of a submission: See the whole stack• Custom Mongoose Plugin:
– ElMongoose: Mongoose >> Elastic Search
40
MongoDB vs Relational DB: Viewing a single submission would have required pulling data from 6 tables if we had use a relational DB:
- Submissions for each app have different form fields
- To make up for lack of flexibility this becomes a complex schema
41
MongoDB vs. Relational DBWith mongo we can store our submissions in a single collection
- All data for a submission resides in one document
- This fits with the way we use submissions in our app.
43
Using Mongoose Models
Submission Schema from previous slide (Submit.js):
Using the schema in server.js (node runs this on start up):
46
Life of a Submission
User fills out a form• Angular has a data model
called $scope• Each form field is bound
to a key in the object stored at $scope.submission
47
Life of a Submission User Submits the form• Left: submission json
generated by the form in the previous slide
• Below: Angular POSTs submission json to /submitForm
$scope.submission
hostedController.js
48
Life of a Submission User Submits the form• Left: submission json
generated by the form in the previous slide
• Below: Angular POSTs submission json to /submitForm
$scope.submission
hostedController.js
49
Life of a Submission
Request is received by ExpressJS• Express is listening at port 3000 for all requests• It’s easy to define routes in express
50
Submission is saved to Mongo• Left: the json object has not
changed• Below: submission saved to
Mongo through the Mongoose Model Sub
Life of a Submissionreq.body
52
Search and analytics engine
Hook into your Mongoose Models: Elastic Search
Fuzzy Matching, Relationships, Complex Aggregations
53
Try ElMongoose
https://www.npmjs.com/package/elmongoose
El
54
ElMongoose: Plugin for syncing data with elastic search through mongoose.
Hook into your Mongoose Models: Elastic Search
55
ElMongoose: Plugin for syncing data with elastic search through mongoose.
Hook into your Mongoose Models: Elastic Search
65
How Modular Development?
CORE PROJECT
Login Rolodex Email
Features
ModuleRoutes Controllers Assets
67
How Modular Development?
ModuleRoutes Controllers Assets
CORE Project
ModuleRoutes Controllers Assets
SUB Module
75
Multi Tenant Application(Software as a Service)
Application
DatabaseCollection Collection CollectionCollection
76
Multi Tenant Application(Software as a Service)
Application
DatabaseDeveloper ID Admin ID Party Animal ID
Developer Administrator Party Animal
79
SAAS - How Do We Do It?(Software as a Service)
Tenant Type
User Parameters
Instance Build
New Application
80
SAAS - How Do We Do It?(Software as a Service)
Tenant Type
User Parameters
Instance Build
New Application
Multi Tenant or Single Tenant?
81
SAAS - How Do We Do It?(Software as a Service)
(spec file with parameters)
Tenant Type
User Parameters
Instance Build
New Application
82
SAAS - How Do We Do It?(Software as a Service)
Tenant Type
User Parameters
Instance Build
New Application
83
SAAS - How Do We Do It?(Software as a Service)
Tenant Type
User Parameters
Instance Build
New Application
85
MORE OPPORTUNITIES!!!
careers.washingtonpost.com@wpcareers
● We’re in a unique environment in our team.
● What we are working has visibility.
● We could re-invent ourselves with any challenge.
● If you proved it could work, we could use it.
● Ownership of projects from end to end.
● No Red Tape
● Our work is more fulfilling.
87
Contact
Matt CwalinskiLinkedIn: https://www.linkedin.com/in/mcwalinski
Twitter: @mcwalinski
Kat StyonsLinkedIn:https://www.linkedin.com/pub/kat-styons/48/3a4/604Twitter: @HappyKatTweets
Sruti CheedallaLinkedIn:https://www.linkedin.com/in/sruticheedallaTwitter: @shrootyc
Follow us on Twitter, @SubPlatform!
88
Resources
• MongoDB• Mongoose.js• Elasticsearch• Express.js• AngularJS• Node.js• https://www.npmjs.com/package/elmongoose• http://coenraets.org/blog/