Giter Club home page Giter Club logo

vue-til-server's Introduction

Vue TIL 애플리케이션 Node.js 서버 코드

인프런 Vue.js 끝장내기 강좌 TIL 애플리케이션의 백엔드 API를 제공하는 Node.js 코드 리포지토리입니다.

개발 환경

NVM 설치 및 버전 변경 방법

이 리포지토리의 Node.js 소스는 버전 10.16과 호환됩니다. 로컬에 Node.js가 설치되어 있지 않은 분들은 위에서 안내한 링크로 다운로드 받습니다.

만약 이미 다른 버전의 Node.js를 사용하는 분들은 NVM(Node Version Manager)을 이용하여 Node.js 버전을 맞춰주시면 됩니다.

설치 절차

  1. VSCode의 내장 터미널을 bash로 실행하고 아래 명령어를 입력합니다.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
  1. 설치가 완료되면 터미널에서 아래 명령어로 nvm 명령어를 시스템 레벨에 추가합니다.
vi ~/.bashrc
# vi로 연 .bashrc 파일에 "i" 키를 입력하여 쓰기 모드로 진입합니다.
# 그리고 나서 아래 내용을 추가하고 ":"를 입력한 다음 "wq"를 입력하여 저장 후 종료합니다.
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
  1. 이제 터미널에 nvm 명령어를 입력하면 인식이 되는지 확인합니다.
  2. 인식되면 아래의 명령어로 Node.js를 설치합니다.
nvm install 10.16
  1. 설치가 끝나면 아래의 명령어로 Node.js 버전을 변경합니다.
nvm use 10.16
  1. 설치한 이후 아래 명령어로 Node.js 버전이 잘 설정되었는지 확인합니다.
node -v

서버 실행 절차

  1. 로컬에 Node.js를 설치합니다.
  2. 리포지토리를 클론한 다음 아래 명령어를 실행합니다.
# Node.js를 실행하기 위해 필요한 라이브러리를 설치하는 명령어
npm i
  1. package.json에 정의되어 있는 실행 명령어를 입력합니다.
npm run start
  1. 명령어 실행 창에서 아래와 같은 메시지가 떴는지 확인합니다.

success-log

API 문서 확인 절차

TIL 애플리케이션의 백엔드 API는 아래 주소에서 확인할 수 있습니다.

http://localhost:3000/api/docs

Mongo Cloud 가입 절차

애플리케이션의 데이터는 몽고 DB에 저장합니다. 실습 환경을 빠르게 구성하기 위해서 로컬에 몽고 DB를 설치하지 않고 몽고 DB 클라우드 서비스를 사용할게요.

몽고 DB 클라우드 서비스 사이트

  1. 다음 링크로 몽고 DB 클라우드 서비스에 가입합니다. 가입 페이지
  2. 가입한 계정으로 로그인
  3. 무료 인스턴스 생성. 꼭 Free Tier를 선택하세요!
  4. Database Access - 데이터베이스 접속을 위한 계정 생성. 예시) test/1234
  5. Network Access - ADD IP ADDRESS 버튼 클릭 후 ALLOW ACCESS FROM ANYWHERE 버튼 클릭 또는 현재 IP만 화이트리스트로 등록
  6. Clusters
    1. 메인 페이지의 CONNECT 버튼 클릭
    2. Connect Your Application 클릭
    3. DRIVERNode.js 선택
    4. VERSION3.0 or later 선택
    5. Connection String 복사 후 app.js 파일의 아래 부분에 붙여넣기
mongoose.connect('여기다가 붙여넣으세요.', {
  useNewUrlParser: true,
});
  1. Node.js 서버 재 실행 후 API 동작 여부 확인

License

MIT - CaptainPangyo

vue-til-server's People

Contributors

joshua1988 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.