Skip to content

Revisiting recipe app to exercise MERN, test-driven development, routing, authentication, and databases

License

Notifications You must be signed in to change notification settings

mtanzim/recipe-app-v2

Repository files navigation

Project 4: Dynamic Recipe Storage App Backend Overhaul

Overview

As of 6/26/2018, this project is marked complete. The unfinished tasks will be continued after further educational pursuits.

Fullstack application being developed for educational purposes, using the MERN stack.

The original app can be found here:

The following repositories will be used for guidance:

The following additional Freecodecamp lessons are to be used as reference:

The following Freecodecamp challenges were completed with a focus on information security and testing:

The following Freecodecamp challenges were completed with a focus on React:

Objectives

Take existing app and improve the app with knowledge acquired over the past projects.

Overall Improvements

  • Implement a friend's list feature on front and back end
  • Implement a live chat, exercising socket IO

Back end Improvements

  • Updated routing strategies
  • Use of es6 code/transpiling with babel
  • Unit testing with Mocha for each API instance
  • General code cleanup following best practices
  • Improve understanding of Mongo/Mongoose
  • Mocking relations with Mongoose Populate
  • Usage of MySQL database in conjunction with Mongo
  • Implement a friend's list feature with SQL
  • Integration of Redis for sessions storage
  • Authentication with JWT
  • Improvements to async code with async/await functions in conjunction with promises

Front End Improvements

  • Take existing app and improve the front end with knowledge acquired over the past projects
  • Implement state managment through redux (possibly study redux in greater detail through Lynda.com)
  • Clean up React code; learn and apply lifecycle mangaement hooks
  • Convert to an app using React Native

Lessons Learned

  • SQL/Sequelize
    • Creating models (data types, primary keys, foreign keys, associations)
    • CRUD operations through ORM (queries, attribute selection)
    • Hooks and custom methods (password hashing)
    • Promise based operations
    • Creating a friend list with an RDB
    • Creating a many to many relationship with the friend list model
    • Executing raw queries as required when object functions are more cumbersome
  • Mongoose/MongoDB
    • Select clauses
    • Promise vs callbacks
    • Queries are thenable (then-ing a query executes it automatically)
    • Creating references in Mongoose, similar to foreign keys in sql
    • Using the pre 'remove' hooks for cascading deletes, similar to SQL
    • Making sure doc.save, and doc.remove are used to ensure hooks are fired
  • Express
    • Error routing and management
    • Export app.js and using bin/www to run the server, and mocha to test concurrently
    • Working with callbacks vs promises
    • Passport.js: passing errors and user around
  • Mocha testing
    • Describe, it, before hooks
    • Looping tests in mocha
    • Setting up logging, creating documents
    • Creating re-usable modules in describe, it blocks
    • Note to create designs that are scalable (example: adding SQL API tests required a lot of unnecessary factoring, default parameters etc.)
  • Postman Testing
  • package.json scripts
  • JS/ES6