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
- loadcomplete
- PostgreSQL
- graph database
- tortoise SVN
- OGM
- STS
- Windows 10
- Eclipse
- PG-Strom
- tomcat
- Maven Project
- NextJs
- JSP
- HTML Code
- springboot
- 서브라임 텍스트
- BRIN
- MariaDB
- maven
- Java
- Spring Boot
- Next.js
- NestJS
- Spring
- Spring Cloud
- orioledb
- typeorm
- Can't load AMD 64-bit .dll on a IA 32-bit platform
- exit code = -805306369
- HTML Special Entity
Archives
- Today
- Total
Undergoing
03. Next.js 붓기 본문
개념이 확실하게 서지 않고 막연하게 Nest 보자고 생각했을 때에는 Next랑 React를 별개로 봤는데 그렇지 않음.
이렇게 또 게으른 무식함이 탄로남..
1. next.js 생성
C:\Users\LG\IdeaProjects\nest-app>npm create next-app
√ What is your project named? ... frontend
Creating a new Next.js app in C:\Users\LG\IdeaProjects\nest-app\frontend.
Using npm.
Installing dependencies:
- react
- react-dom
- next
npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
added 270 packages, and audited 271 packages in 6s
46 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Installing devDependencies:
- eslint
- eslint-config-next
added 220 packages, and audited 491 packages in 14s
79 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Success! Created frontend at C:\Users\LG\IdeaProjects\nest-app\frontend
Inside that directory, you can run several commands:
npm run dev
Starts the development server.
npm run build
Builds the app for production.
npm start
Runs the built app in production mode.
We suggest that you begin by typing:
cd frontend
npm run dev
2. frontend의 package.json 설정
// 3001 포트로 frontend 구동하게끔 설정
// package.json
"scripts": {
"front": "next dev -p 3001",
"build": "next build",
"start": "next start"
}
이제 npm run front로 구동 가능.
3. client-server 간 proxy 설정
npm install http-proxy-middleware --save
이후 frontend 폴더에 setupProxy.js 파일 생성
const proxy = require('http-proxy-middleware');
module.exports = function (app) {
app.use(
proxy('/api', {
target: 'http://localhost:3000',
changeOrigin: false,
})
);
};
기본 구조는 이제 끝났고, 앞으로 뭘 해볼지는 생각해봐야 할듯.
'개발 > Web Development' 카테고리의 다른 글
02. Nest - PostgreSQL 연동 (0) | 2021.08.10 |
---|---|
01. Nest (0) | 2021.08.04 |
[AngularJS] 기본 개발 환경 세팅 (0) | 2017.06.22 |
[jqgrid] loadcomplete를 이용하여 검색 결과 처리 (0) | 2015.03.13 |
[Spring] @ResponseBody 리턴 시 한글 깨짐 문제 (1) | 2014.11.26 |