John Ahn [따라하며 배우는 노드, 리액트 시리즈 - 기본 강의]
공부 내용 정리
Node.js
JavaScript를 Chrome이나 IE가 아닌 server-side에서도 쓸 수 있는 언어
Express.js
- node.js를 이용하여 웹브라우저, 어플리케이션을 쉽게 구현할 수 있게 돕는다.
- node.js를 위한 프레임워크
Model
- Schema를 감싸주는 역할
Schema
- 만약 어떤 상품에 관한 글을 작성한다 했을 때, 작성인은 누구인지, 포스트의 이름은 무엇인지, 최대 몇 자인지 등 하나하나의 정보 지정
const mongoose = require('mongoose');
const userSchema = mongoose.Schema({
// mongoose를 이용해 Schema생성
name:{
type: String,
maxlength: 50
},
email: {
type: String,
trim: true,
// 공백 없애는 역할
unique: 1
//똑같은 email 쓰지 못하게
},
password: {
type: String,
minlength: 5
},
lastname: {
type: String,
maxlength: 50
},
role: {
// 관리자인지 일반유저인지
type: Number,
default: 0
// ex) 관리자면 0, 일반유저면 1
},
image: String,
token: {
// 유효성 관리
type: String
},
tokenExp:{
// 토큰의 유효기간
type: Number
}
})
const User = mongoose.model('User', userSchema)
// const User = mongoose.model('model의 이름', Schema)
// Schema를 model로 감쌈
module.exports = {User}
// export해서 이 model을 다른 파일에서도 사용할 수 있게 함
GIT | GIT HUB |
- 소스 코드를 관리할 수 있는 tool - distributed version control system |
- GIT에서 관리하고 있는 소스코드를 많은 사람들과 공유 / 관리 할 수 있는 클라우스 서비스 |
Working Directory → git add .→ Staging Area → git commit → Git repository(LOCAL) → git push → Git repository(REMOTE)
Working Directory : 아무것도 하지 않은 상태
Staging Area : Git repository(LOCAL)에 넣기 전에 대기시켜 주는 곳
Git repository(LOCAL) : 내 PC에 파일 저장. 개인 저장소.
Git repository(REMOTE) :
- 파일이 원격 저장소 전용 서버에서 관리 됨.
- 여러 사람이 함께 공유하기 위한 저장소
- Github, 클라우드 서비스 하는 곳에 올리는 것
node_modules파일 : 너무 크기 때문에 git 저장소에 올리지 않아도 된다.
그래서 .gitignore 파일을 만들고 그 안에 node_modules를 적어 없애준다.
SSH (Secure Shell)
- GIT을 GIT HUB에 안전하게 연결
Postman
- API 개발을 빠르고 쉽게, 개발된 API를 테스트할 수 있고, 팀원들간 공유를 할 수 있게 해주는 플랫폼
- login, sign up을 할 때 data를 찍을 client없이 보낼 수가 없으니 postman을 이용
참고
강의 : youtu.be/BpE2IYu2p-0
칼럼 : https://devkyeol.tistory.com/entry/Postman-개요-설치-사용법-활용-방법
댓글