diff options
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/index.js b/src/index.js index d563c0f..7887dee 100644 --- a/src/index.js +++ b/src/index.js @@ -1,17 +1,19 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import App from './App'; -import reportWebVitals from './reportWebVitals'; +const express = require('express'); +const app = express(); +const port = 5001; -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render( - <React.StrictMode> - <App /> - </React.StrictMode> -); +let count = 0; -// If you want to start measuring performance in your app, pass a function -// to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); +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}`); +}); |