express 로 sunnyforpv.kr 웹서버 만들기

express --view=ejs sunnyforpv.kr cd sunnyforpv.kr yarn install  yarn upgrade # write .env PORT=8092 TZ=Asia/Seoul pm2 start sunnyforpv.config.js  pm2 restart all -i max pm2 list # check web app curl  http://127.0.0.1:8092 # write nginx conf server {     listen 80;     server_name sunnyforpv.kr www.sunnyforpv.kr;     root /home/eoullim/server/sunnyforpv.kr;      location / {         proxy_pass http://127.0.0.1:8092;         proxy_http_version 1.1;         proxy_set_header Upgrade $http_upgrade;         proxy_set_header Connection 'upgrade';         proxy_set_header Host $host;         proxy_cache_bypass $http_upgrade;     } } sudo certbot --nginx -d sunnyforpv.kr -d www.sunnyforpv.kr sudo systemctl restart nginx

Visual Studio Code How to find a file by file name on Macbook

Visual Studio Code  How to find a file by file name on Macbook command + p append : to go to line or @ to go to symbol  ex) app.js:50 // go to line 50 in app.js file ex) app.js@path // go to symbol path in app.js file 

javascript loop sample

var i = 1 ; list . forEach ( function ( item ) { console . log ( item ); item . ranking = i ++; }); var obj = { a: 1 , b: 2 , c: 3 }; for ( var key in obj ) { console . log ( key , obj [ key ]); }

How to connect to remote MongoDB server

How to connect to remote MongoDB server ~ $  sudo vi /etc/mongod.conf # network interfaces net:   port: 27017   bindIp: 127.0.0.1   bindIpAll: true ~ $ sudo service mongod restart

Show free space of storage on Linux

$ df Filesystem     1K-blocks     Used Available Use% Mounted on udev               998984       0     998984   0% /dev tmpfs             203840     8408     195432   5% /run /dev/xvda1       49563892 3523424   43499720   8% / tmpfs             1019184       0   1019184   0% /dev/shm tmpfs               5120       0       5120   0% /run/lock tmpfs             1019184       0   1019184   0% /sys/fs/cgroup tmpfs             203944       0     203944   0% /run/user/1000 tmpfs             203944       0     203944 ...

Import csv tsv file into MongDB

When the csv or tsv file has headerline csv $ mongoimport -d <database> -u <username> -c <collection> --type csv --headerline --file <filename> tsv $ mongoimport -d <database> -u <username> -c <collection> --type tsv --headerline --file <filename> When the csv or tsv file doesn't have headerline and set field type $ mongoimport -d <database> -u <username> -c <collection> --type tsv --columnsHaveTypes --fields "name.string(),register.boolean(),phone.int32()"  --file <filename> https://docs.mongodb.com/manual/reference/program/mongoimport/

자주쓰는 MongoDB 명령어

# remove a document on MongoDB $ db.<collection>.remove({ _id: ObjectId("id")}); # update a document  on MongoDB # change name to "bao" $ db.<collection>.update({ _id: ObjectId("") }, { $set: { name: "bao" }}); # update multi documents  on MongoDB # find all documents which type is not "t" and then change their type to "n" $ db.<collection>.update({ type: { $ne: 't' }}, { $set: { type : ''n" }}, { multi: true });