server.js 469 Bytes
Newer Older
Choi Ga Young's avatar
Choi Ga Young committed
1
2
3
4
import express from 'express';

const app = express() //express 사용

Choi Ga Young's avatar
Choi Ga Young committed
5
6
app.use(express.static('../client/build'))

Choi Ga Young's avatar
Choi Ga Young committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
app.get('/', (req, res)=>{
  res.send('Hello')
}) //get은 받는 부분 send는 보내는 부분.

app.get('/home', (req, res)=>{
  res.send('Home')
}) 

app.put('/signin', (req, res)=>{
  res.send('Sign in')
}) 

app.listen(3001,()=>{
  console.log('Server is listening on port 3001')
}) //웹 서버가 구동이 되면 화살표 함수가 실행됨.