Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 스프링부트 에러
- 강좌 정리
- 노션
- aop
- 비지도학습
- express
- 스프링
- 스프링 빈
- 노드
- Do It 정직하게 코딩하며 배우는 딥러닝 입문
- jetbrains
- Dependency Injection
- 의존성주입
- IoC 컨테이너
- 스프링 프레임워크
- timezone error
- express-generator
- 노션 Formula
- 딥러닝
- 백기선 강좌
- database error
- 지도학습
- 기계학습
- krpano
- 프레임워크
- Proxy 패턴
- syncronized
- @Autowired
- 강화학습
- PSA
Archives
- Today
- Total
hyungmuk's blog
express-generator 본문
express-generator 설치
npm i -g express-generator
express-generator 를 설치하면 express 명령어를 사용할 수 있다.
express 명령어 사용법
터미널에 express -h
를 입력하면 express 명령어 사용법
이 나온다.
express -h
Usage: express [options] [dir]
Options:
--version output the version number
-e, --ejs add ejs engine support
--pug add pug engine support
--hbs add handlebars engine support
-H, --hogan add hogan.js engine support
-v, --view <engine> add view <engine> support (dust|ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade)
--no-view use static html instead of view engine
-c, --css <engine> add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css)
--git add .gitignore
-f, --force force on non-empty directory
-h, --help output usage information
예제
express --no-view .
현재 디렉토리에 express 관련 디렉토리와 파일을 생성한다.
express --no-view .
destination is not empty, continue? [y/N] y
create : public\
create : public\javascripts\
create : public\images\
create : public\stylesheets\
create : public\stylesheets\style.css
create : routes\
create : routes\index.js
create : routes\users.js
create : public\index.html
create : app.js
create : package.json
create : bin\
create : bin\www
install dependencies:
> npm install
run the app:
> SET DEBUG=mask-map:* & npm start
패키지들을 다운로드 하기 위해 npm install
을 실행한다.
npm install
npm notice created a lockfile as package-lock.json. You should commit this file.
added 52 packages from 36 contributors and audited 135 packages in 4.741s
found 0 vulnerabilities
다음과 같은 구조로 express 프로젝트가 생성되었다.

express 실행
npm start
> mask-map@0.0.0 start C:\00.dev\vue\mask-map
> node ./bin/www
http://localhost:3000/ 로 접속하면 index 페이지를 확인 할 수 있다.
포트 번호 바꾸기

bin폴더에서 www을 에디터로 열어서 코드를 수정하자.

기본 포트 번호가 3000으로 되어있다.
var port = normalizePort(process.env.PORT || '8000');
app.set('port', port);
8000으로 수정 후 다시 npm start를 하면 http://localhost:8000/ 으로 접속 된다.