작성하는 이유?

  • 로그 파일, 빌드 결과 파일등 직접 수정할 필요 없고 버전관리에  불필요한 파일 업로드 방지

자동생성 사이트 

  • 사용하는 IDE, 언어 입력하면 자동으로 생성

https://www.toptal.com/developers/gitignore

 

gitignore.io

Create useful .gitignore files for your project

www.toptal.com

설정 방법

    •  # : 주석
    • *.log : 확장자가 .log 로 끝나는 모든 파일을 무시
    • 폴더이름/ : 폴더 이름안에 있는 모든 파일을 무시
    • /파일이름 : 현재 폴더에 있는 특정 파일 무시
    • 무엇을 해야 할지 모르면 https://github.com/github/gitignore 참고

추가 방법

  • 최상위 폴더에 위치시키기
  • 이미 추가한 파일을 무시하고 싶으면,  .gitignore을 커밋하기전에 추가된 파일의 추적을 해제필요
git rm --cached <file name or .(all)>

---> git add . 를 하고나서 내가 원하지 않는 파일 혹은 폴더가 추가 되었다면

git rm --cached -r 파일명 혹은 폴더명
  •  -r  :  재귀적 제거를 허용합니다 

 

 

참고한 곳

https://www.git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository

https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

 

pip freeze > requirements.txt

@file:// -> 배포시 오류발생 일으킬 수 있음

pip list --format=freeze > requirements.txt

@ file://..... 사라짐

'프로그래밍 > Python' 카테고리의 다른 글

한 파일에 있는 여러개의 Json 파일 읽기  (0) 2023.07.21

git add  파일들

git commit -m 커밋 내용..

git push

했는데 오류 발생

 

-----

git push -u origin main 으로 해결

 

Express :  Node.js 를 위한 웹 어플리케이션 프레임워크  -expressjs.com-

Node.js?  cross-platform( Linux, macOs, Windows), open-source, JavaScrpit rumtime environments


Express 관련 문서가 있는 사이트

https://expressjs.com/en/guide/routing.html

Installing

※ Node.js 는 설치되어 있다고 가정

$ npm init
  • npm : Software registry(library), open-sourse develper 들이 소스를 공유하기위해 사용
  • npm init 을 실행하면 package.json 이 생성됨
    • Node.js ecosystem(이게 뭘까??)의 핵심
    • Node.js, npm, javaScript를 이해하고 작업하는데 기초적인 중요 요소
    • 응용 프로그램, 모듈, 패키지 등에 대한 정보를 저장하는 매니페스트로 사용
      • manifest??-> 무엇이 있는지 기록되어있는 목록
        • [사전]:(v) to show something cleary, through sings or actions
                     (n) a list of people and goods carried on a ship or plane
$ npm i express
  • install express

서버코드 작성

// respond with "hello world" when a GET request is made to the homepage

 

  • app.get(’/’, (req, res) ⇒ …)    Get method를 app 의 root 에 정의
    • respond with "hello world" when a GET request is made to the homepage 
      • 홈페이지 주소를  입력해서 접속 => GET request => reponse로  "Hello world!!" 출력
    • app.get() : Get requests를 다루기 위한 메소드
    • res.send ()
      • res (reponse) : object  → send a respones to client
        • client: 서버에 데이터를 요청한 어떤 것/ 사람
      • This route path will match requests to the root route, "/".
    • req 
      • req (request) : object
  • app.listen(port, () …) ?
    • 원하는 port 에 서버를 오픈, ()=>: 서버오픈시 실행할 코드

<정리> 웹 서버 구축 순서

1. 폴더생성 -> 폴더에서

npm init
npm i express

2. app.js 생성 후 서버 실행 

  • node app.js

# 앞으로 데이터를 json 형식으로 주고 받을 예정이므로 chrom에 아래 링크된 확장자 설치하면 json을 보기 편함

 

JSON Formatter

Makes JSON easy to read. Open source.

chrome.google.com

 

Repositoy 이름 변경

StudyNodeJs => StudyExpress

remote: This repository moved. Please use the new location:
remote:   https://github.com/JW0203/StudyExpress.git
To https://github.com/JW0203/StudyNodeJs.git

-> l

 

-> origin 지우고 재설정

+ Recent posts