forked from CODE-U-S/NodeJs_Study_Riyeon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
39 lines (32 loc) · 651 Bytes
/
app.js
File metadata and controls
39 lines (32 loc) · 651 Bytes
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
32
33
34
35
36
37
38
const express = require('express');
const app = express();
const port = 3000;
app.get('/data', (req, res) => {
res.send("Hello Worl Test");
});
let arr = [];
app.post('/array-test', (req, res) => {
arr.push({
name: 'lee',
age: 20
});
res.send(arr);
});
app.post('/array-test2', (req, res) => {
arr.push({
name: 'park',
age: 30
});
res.send(arr);
});
app.get('/array-test', (req, res) =>{
res.send(arr);
});
app.delete('/array-test', (req, res) => {
arr = [];
res.send(arr);
});
// 서버 실행
app.listen(port, () => {
console.log(`App running on port ${port}`);
})