---
# System prepended metadata

title: '2009-GHP-RM-WEB-FT Cookie Jar: Sequelize'

---

# 2009-GHP-RM-WEB-FT Cookie Jar: Sequelize

## Put your questions in a '##' tag below

Example:

## What is JavaScript?

## If we do "npm install" do we then need to do "npm install express/nodemon/sequelize/pg/etc"?

## Answer

If there is a `package.json` and in it there is `express` or whatever as a dependency, then when you run `npm install`, it will install express and other dependencies listed. However, if a module is not there, then you need to install it specifically

## Do I need a node_modules folder saved onto my local drive?

## Answer

Nope! `node_modules` is usually a result when you `npm install` inside a repo with a `package.json`


## Does postgres port and server port need to match? I've tried them both at 3000, and postgres at 5432 and server at 3000 and both worked?

## Answer

Nope! Each process/application should have its own port otherwise you get an error that looks like this: ERRADDRINUSE

## When do we use .beforeValidate compared to .beforeCreate? Why choose one over the other? (I'm getting them confused...)

It depends on the feature. There is a validate step in the lifecycle and there are validations you can you write inside your model (for example, checking if an input is a credit card). So, if you need to do something that happens before validating the input, then use the `.beforeValidate`. If that's not a concern, then the `.beforeCreate` is fine which happens after `.beforeValidate`. 

## Why are we named 2009? not 2020?

2009 -> 20 = 2020, 09 = 9th Month