Velog 첫번째 포스팅

오브젝트 병합

Object.assign(obj1, obj2);

Object.assign method merge obj2 to obj1

Sequelize basic syntax

basic_initiationsequelize
count === select count(*) from where
findAll === select attributes from where
findOne === select district attributes from where
>>> option ( where, order, attributes , include)
include: [ model: Tables, attributes: [columnname1, columnname2]}
pm2 package - for non-stop service
command list
pm2 start app.js
pm2 monit  // monitoring all processes
pm2 list   // List all processes
pm2 stop
pm2 restart
pm2 stop

in macOS homebrew

**Error: undefined method 'release' for OS::Mac:Module**
`rm -r /usr/local/Caskroom/graphviz`
and it works.
That is due to the package graphviz was moved to homebrew/Core instead from cask.23

mysql 8

aws ec2 mysql 원격접속 안될 때

env: aws ec2 / ubuntu 18.04 / mysql 8

[root@smson root]# vi /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
skip-name-resolve
bind-address            = 0.0.0.0
back_log                = 768
basedir                 = /opt/mysql/
connect_timeout         = 30
  • skip-name-resolve는 client 에서 server로 접속시에 DNS Lookup 과정을 생략해 줌.
    localhost 로 접속하는 경우는 문제가 없지만 IP 로 접속하는 환경에서는 DNS 서버가 느리거나 아님 장애 발생시에 해당 옵션을 설정해 주므로써 DB 접속시에 문제점을 해결하실 수 있다.
  • bind-arddress는 mysql daemon 실행 시 접속 가능한 ip를 지정해줄 수 있다.

계정에 호스트, 권한 값도 추가해주어야함

mysql> CREATE USER 'ohdear_ci'@'localhost' IDENTIFIED BY 'ohdear_secret';
Query OK, 0 rows affected (0.11 sec)

mysql> GRANT ALL ON ohdear_ci.* TO 'ohdear_ci'@'localhost';
Query OK, 0 rows affected (0.15 sec)

ESlint

eslint가 jest의 test 메소드를 인식하지 못할 때

add

"env":{
  "jest":true
}

in .eslintrc

if you want don't apply eslint to some files or directories

create .eslintignore file in root directory
ESLint docs about Igonring rules