Skip to content

πŸ—‚ ScrapSharedDocument /2019 Naver Whale ext. Contest for BackEnd πŸŽ¬μ‹œμ—°μ˜μƒ->

Notifications You must be signed in to change notification settings

Gongppu/SSD_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SSD_server

TAB으둜 μ›ΉλΈŒλΌμš°μ €λ₯Ό 이동할 ν•„μš” 없이 λ‚΄ 생각을 ν•œλ²ˆμ— μ •λ¦¬ν•˜μž

μ›¨μΌλΈŒλΌμš°μ €μ—μ„œλŠ” ν•˜λ‚˜μ˜ μ°½μ—μ„œ μ•„λž˜μ˜ μž‘μ—…μ„ μ „λΆ€ ν•  수 μžˆλ‹€

Using

BackEnd
  • Node.js

  • express.js

  • AWS infra(RDS, EC2, SSL, S3)

  • RestFul API JSON ν˜•μ‹μœΌλ‘œ End Point에 뿌렀쀌.

  • var cors = require('cors'); app.use(cors()); 둜 cors μ„€μ •

  • 넀이버 μ•„μ΄λ””λ‘œ 둜그인 API



Screen Shots




Setting

config/ 폴더 생성 ν›„, μ•„λž˜μ˜ 4개 파일

  1. dbPool.js
var mysql = require('promise-mysql')

const dbConfig = {
    host : '',
    port : '',
    user : '',
    password : '',
    database : '',
    connectionLimit : 20
 };

module.exports = mysql.createPool(dbConfig);
  1. awsConfig.json
{
	"accessKeyId": "",
	"secretAccessKey" : "",
	"region" : "ap-northeast-2"
}
  1. multer.js
const multer = require('multer');
const multerS3 = require('multer-s3');
const aws = require('aws-sdk');
aws.config.loadFromPath('./config/awsConfig.json');

const s3 = new aws.S3();

const upload = multer({
    storage: multerS3({
        s3: s3,
        bucket: '',
        acl: 'public-read',
        key: function(req, file, cb) {
            cb(null, Date.now() + '.' + file.originalname.split('.').pop());
        }
    })
});

module.exports = upload;
  1. secretKey.js
module.exports = {
    secret : "(Anykey you want)"
}



Build

git clone https://github.com/Weatherook/server
cd server
npm config package-lock false //package-lock 생성 λͺ»ν•˜κ²Œ ν•„μš”μ‹œμ—
npm start

integrity checksum failed 였λ₯˜κ°€ λ‚˜λŠ” 경우 npm cache clean --force μ‹€ν–‰



Nginx μ„€μ •

μ›Ήμ„œλ²„ 접속 ν›„, 진행

  1. sudo apt update -y && sudo apt-get install nginx -y

2. sudo systemctl status nginx
3. sudo systemctl start nginx , sudo systemctl enable nginx
4. Nginx μ„€μ •νŒŒμΌ μˆ˜μ • ```sudo vi /etc/nginx/sites-available/defalut```
server{
	listen 8080;
	sever_name ip;
	location /{
	 proxy_pass http://ip:포트번호;
	 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;
	}
	location /public{
	 root /usr/loca/var/www;
	}
     } 
server {
      listen 80;

      server_name ip;

      ## redirect http to https ##
      rewrite (path μ •κ·œμ‹ ν‘œν˜„μœΌλ‘œ);

}

5. sudo service nginx restart

Find Me

About

πŸ—‚ ScrapSharedDocument /2019 Naver Whale ext. Contest for BackEnd πŸŽ¬μ‹œμ—°μ˜μƒ->

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages