aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.js
blob: 7887dee4d0ab146bb67df44e55e7cde7d049d8e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const express = require('express');
const app = express();
const port = 5001;

let count = 0;

app.get('/api', (req, res) => {
  // res.send('Hello World!');
  res.json({ count });
});

app.post('/api', (req, res) => {
  ++count;
  res.json({ count });
});

app.listen(port, () => {
  console.log(`listen server on http://localhost:${port}`);
});