-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f29be1
commit 583d96f
Showing
20 changed files
with
2,359 additions
and
0 deletions.
There are no files selected for viewing
Submodule SuRin
added at
16da1e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"watch": ["src", ".env"], | ||
"ext": "js,ts,json", | ||
"ignore": ["src/**/*.spec.ts"], | ||
"exec": "ts-node --transpile-only ./src/index.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "seminar2-assignment", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "nodemon", | ||
"build": "tsc && node dist" | ||
}, | ||
"dependencies": { | ||
"express": "^4.18.1" | ||
}, | ||
"devDependencies": { | ||
"@types/express": "^4.17.14", | ||
"@types/node": "^18.8.3", | ||
"nodemon": "^2.0.20" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import express, { Request, Response, Router } from "express"; | ||
|
||
const router: Router = express.Router(); | ||
|
||
router.get("/", (req: Request, res: Response) => { | ||
return res.status(200).json({ | ||
status: 200, | ||
message: "blog 라우터지렁이", | ||
}); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import express, { Request, Response, Router } from "express"; | ||
|
||
const router: Router = express.Router(); | ||
|
||
router.get("/", (req: Request, res: Response) => { | ||
return res.status(200).json({ | ||
status: 200, | ||
message: "comment 라우터지렁이", | ||
}); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import express, { Router } from "express"; | ||
|
||
const router: Router = express.Router(); // express 라우팅 시스템을 받아올거! | ||
|
||
router.use("/user", require("./user")); | ||
router.use("/blog", require("./blog")); | ||
router.use("/comment", require("./comment")); | ||
router.use("/movie", require("./movie")); | ||
router.use("/members", require("./members")); | ||
|
||
module.exports = router; // 모듈로 반환 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import express, { Request, Response, Router } from "express"; | ||
|
||
const router: Router = express.Router(); | ||
|
||
const members = [{ | ||
name: "권세훈", | ||
group: "ob", | ||
}, | ||
{ | ||
name: "박수린", | ||
group: "yb", | ||
}, | ||
{ | ||
name: "남지윤", | ||
group: "ob", | ||
}, | ||
{ | ||
name: "김혜수", | ||
group: "ob", | ||
}, | ||
{ | ||
name: "이종현", | ||
group: "ob", | ||
}] | ||
|
||
router.get("/", (req: Request, res: Response) => { | ||
return res.status(200).json({ | ||
status: 200, | ||
members | ||
}); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import express, { Request, Response, Router } from "express"; | ||
|
||
const router: Router = express.Router(); | ||
|
||
router.get("/", (req: Request, res: Response) => { | ||
return res.status(200).json({ | ||
status: 200, | ||
message: "movie 라우터지렁이", | ||
}); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import express, { Request, Response, Router } from "express"; | ||
// express 모듈에서 express, (request, response, router)-> 타입 정의를 위해 불러옴! | ||
|
||
const router: Router = express.Router(); | ||
|
||
router.get("/", (req: Request, res: Response) => { | ||
return res.status(200).json({ | ||
status: 200, | ||
message: "user 라우터지렁이", | ||
}); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import express, { NextFunction, Request, Response } from "express"; | ||
|
||
const app = express(); // express 객체 받아옴 | ||
const PORT = 3000; // 사용할 port를 3000번으로 설정 | ||
|
||
app.use(express.json()); // express 에서 request body를 json 으로 받아오겠다. | ||
|
||
app.use("/api", require("./api")); // use -> 모든 요청 | ||
// localhost:8000/api -> api 폴더 | ||
// localhost:8000/api/user -> user.ts | ||
|
||
//* HTTP method - GET | ||
app.get("/", (req: Request, res: Response, next: NextFunction) => { | ||
res.send("서버지렁이"); | ||
}); | ||
|
||
app.listen(PORT, () => { | ||
console.log(` | ||
############################################# | ||
🛡️ Server listening on port: ${PORT} 🛡️ | ||
############################################# | ||
`); | ||
}); // 8000 번 포트에서 서버를 실행하겠다! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6", //? 어떤 버전으로 컴파일 | ||
"allowSyntheticDefaultImports": true, //? default export가 없는 모듈에서 default imports를 허용 | ||
"experimentalDecorators": true, //? decorator 실험적 허용 | ||
"emitDecoratorMetadata": true, //? 데코레이터가 있는 선언에 대해 특정 타입의 메타 데이터를 내보내는 실험적인 지원 | ||
"skipLibCheck": true, //? 정의 파일 타입 체크 여부 | ||
"moduleResolution": "node", //? commonJS -> node 에서 동작 | ||
"module": "commonjs", //? import 문법 | ||
"strict": true, //? 타입 검사 엄격하게 | ||
"pretty": true, //? error 메시지 예쁘게 | ||
"sourceMap": true, //? 소스맵 파일 생성 -> .ts가 .js 파일로 트랜스 시 .js.map 생성 | ||
"outDir": "./dist", //? 트랜스 파일 (.js) 저장 경로 | ||
"allowJs": true, //? js 파일 ts에서 import 허용 | ||
"esModuleInterop": true, //? ES6 모듈 사양을 준수하여 CommonJS 모듈을 가져올 수 있게 허용 | ||
"typeRoots": [ | ||
"./src/types/express.d.ts", //? 타입(*.d.ts)파일을 가져올 디렉토리 설정 | ||
"./node_modules/@types" //? 설정 안할시 기본적으로 ./node_modules/@types | ||
] | ||
}, | ||
"include": [ | ||
"./src/**/*" //? build 시 포함 | ||
], | ||
"exclude": [ | ||
"node_modules", //? build 시 제외 | ||
"tests" | ||
] | ||
} |
Oops, something went wrong.