SW Developer/NodeJS Express

Node js Express 초기 작업 npm init git hub 연결

ashespia 2022. 2. 23. 18:41
SMALL

nodejs express Github  repositories  연결 방법

 

Node JS를 정상적으로 윈도우버전으로 설치한 이후에 패키지 매니저인 npm을 통해 express 를 설치하자

 

Node JS 설치 시에 패키지 매니저인 npm 까지는 알아서 설치해준다.

 

express 설치 명령어에 -g 옵션을 통해 전역으로 설정하자

 

cmd 창이나 powershell에서 해당 cmd가 먹는걸 확인할 수 있다.

npm install express-generator -g

 

프로젝트 경로로 가서 npm init 시에 연결할 git 주소를 넣을 수 있다. 

내가 작어하는 working 디렉토리나 workspace 또는 Work 폴더에서 실행해 보자.

PS D:\work\expressToDo> npm init 
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (expresstodo) expresstodo
version: (1.0.0)
description:
git repository: https://github.com/ashespia/expressToDo.git
keywords:
author: Jinkwan lee
license: (ISC)
About to write to D:\work\expressToDo\package.json:

{
  "dependencies": {
    "express": "^4.17.3"
  },
  "name": "expresstodo",
  "version": "1.0.0",
  "main": "exrpesstodo.js",
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Jinkwan lee",
  "license": "ISC",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/ashespia/expressToDo.git"
  },
  "bugs": {
    "url": "https://github.com/ashespia/expressToDo/issues"
  },
  "homepage": "https://github.com/ashespia/expressToDo#readme",
  "description": ""
}


Is this OK? (yes)
PS D:\work\expressToDo>

 

 

express의 dependency 설정파일인 package.json에 github 주소와 bugs 주소 등등 경로가 잘 들어가 있음을 확인할 수 있다. 

 

git 연결까지 잘 되었다면, 내 작업 폴더에 .git 이란 폴더가 생겨있을 것이다.

이는 git 관리를 위한 폴더 이다.

 

자 이제 본격적으로 node js 로 화면을 띄워 보자

"repository": {
    "type": "git",
    "url": "git+https://github.com/ashespia/expressToDo.git"
  },
  "bugs": {
    "url": "https://github.com/ashespia/expressToDo/issues"
  },
  "homepage": "https://github.com/ashespia/expressToDo#readme",
  "description": "��#\u0000 \u0000e\u0000x\u0000p\u0000r\u0000e\u0000s\u0000s\u0000T\u0000o\u0000D\u0000o\u0000\r\u0000 \u0000"
}
LIST