Giter Club home page Giter Club logo

everpresto's Introduction

Everpresto

Automating the document signing process, cause you've got better things to do.

Tech Stack

  • React.js
  • Redux
  • Node.js
  • MongoDB
  • Immutable.js
  • Webpack
  • SASS
  • Flexbox

Common Gotchas

Why do reference id attributes on models not have a ref option?

  • If the ref option is provided. The reference id will not be loaded with with the document. The tradeoff to not using ref is that mongoose's populate function won't work. See Automattic/mongoose#3020

Why are models being required by import instead of mongoose.model in other model files?

  • The is a dependency loading issue. We might want to use ModelB in a static function of ModelA, now ModelA depends on ModelB to be loaded first; but what if ModelA is loaded before ModelB? This would throw a MissingSchema error. This type of cross dependency can get very complicated very fast - so when using models in other models, it's best to import from the direct source.

Why are we using Model.find + Model.save in order to update vs. Model.findOneAndUpdate in some places?

  • Because Model.save is a Mongoose method, which means Mongoose Document pre/post hooks will be run every time save is called (this comes in especially handy in Template.js). Model.findOneAndUpdate and Model.update are actually MongoDB methods, so calling these will not invoke Mongoose Document hooks such as pre('save'). See Automattic/mongoose#2672

**Why are we using res.status(200).json({}) instead of res.status(204).end() when successfully closing a delete response?

  • This is because we're using the fetch. In fetch, data must be converted to JSON using response.json(). However, if the response is empty, response.json() throws an error. Therefore it's better to close the response with an empty object instead. response.json() also fails when the status code is 204, this may be because fetch interperates 204 as an empty response. Therefore, we have to make due by using 200 instead. This is a necessary step to normalize data because there are some instances where we want to send back data after a succesful delete.

everpresto's People

Contributors

johnnyji avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.