Repository files navigation
Baz O'Mahony
Node Developer @Shutterstock
Music team
(2) What are we going to do?
Build an Express 4 web app
Use MongoDB as our datastore
Write some tests
Use swig for templates
And some other shiz
Create a directory for the app to live in.
Express 4 has a separate init script
Not going to use it tonight
Run a simple application
Serve 1 page
(6) A better application structure
Create a more maintainable layout
Use require to help us out
(7) Thinking about testing
Why is this layout difficult to test?
Code smell with fake private conventions
Exposing "controllers" easily
Mocha, Sinon and Chai
Spys, Stubs and Mocks
Setting up for each test.
TDD/BDD is teh bizniz
(10) Mongo and Mongoose models
Connect to the database
Create mongoose model
(11) Templating in Express
Swig
Static middleware
Tell Express about it
res.render()
Extend a layouts
Include a partials
Update model
Express body-parser middleware
Add a new controller
Mount route on different root
(16) Routes with parameters
More RESTful routes
Regexp
Watch out!
About
Talk for Colorado Springs JavaScript meetup
Resources
License
Stars
Watchers
Forks
You can’t perform that action at this time.