Learning MEAN stack with "Getting MEAN with Mongo, Express, Angular, and Node" by Simon Holmes.
The app is currently deployed onto Heroku https://learnmean.herokuapp.com/ and connected with mLab MongoDB.
######Node:
- use npm to install and manage Node packages with package.json
######Express:
- Use Jade node template engine for views http://jade-lang.com/. Seperate common Jade javascrip function into _include folder
- Use nodemon to automatically restart Express app
- Use app.use in app.js for routing
- Use app.set to make REST API json response looks nice
- Build static site. Then, connect views and controllers with routes to create VC model
- Create REST API and test with Chrome app Postman. Use Postman "x-www-form-urlencoded" body type to test POST API
######MongoDB, Mongoose:
- Set up MongoDB as service in Windows 8.1
- Use Mongoose to define schemas for a data model
- Use mongo shell
- Use Mongoose to create GET, POST, PUT REST API
- Use geoNear, geoJSON to calculate distance
######Heroku:
- Use mLab MongoDB add-ons and connect app to production DB.
- Deploy app onto Heroku along with Procfile.
######Javascript:
- "!null" will be evaluated as true.
- What are middleware in Express written in app.js? The lines start with app.use
- What are other things I can use with app.set?
- Can Jade template connect with Reactjs?
- What are callbacks and scopes of Javascrip? Why are they important? How do I practice?
- What would (!undefined) be evaluated? Would it be true?
- Answer: Yes it will be true. javascript reference
- What would req.params && req.params.locationid be evaluated? In console, there are [object Object] with undefined or a string
- Answer: As long as it is undefined, it will be evaluated as false
- MongoDB: how do I easily insert, update and delete data without directly type in mongo shell?
- What is Modular Javascript? How to write one?
- How do I have test driven developmet with Nodejs to test every single function I create?
- What is a returned object parameter in Javascript function?
- Answer: it is like a variable will certainly be returned. Kind of like a pointer be overwritten in C.
- What is "parseInt( total / count, 10)" in Javascript?
- Answer: see javascript reference
- After using PUT REST API, the location has one more path "__v". What is this?
- What is req.body?
- Finish up loc8r
- Play with other features of Express
- Play with other features of Node.js
- Use Reactjs instead of Angularjs
- Mongoose subdoc find id is not working
- Solution: check out the JSON again and the id should be written as "_id" and not just "id"
- DELETE REST API error: Can't set headers after they are sent. It does delete review, but the error put a hold on the server.
- Solution: call sendJsonResponse twice and update res.status twice. Make sure only 1 res being sent. reference
- No "API lookup error" shows.
- Solution: condition (!x instanse of Array) should be written as (!(x instance of Array)) to check whether x is Array
- Routing naming and typo took me much time to debug. How do we improve it?