diff --git a/diskuy/package.json b/diskuy/package.json index 3d5998a4b149bf319941576bf9b5c2259fb70d14..9089007af1fe7121e1070d69526e06d0764007af 100644 --- a/diskuy/package.json +++ b/diskuy/package.json @@ -7,6 +7,7 @@ "@testing-library/react": "^11.2.2", "@testing-library/user-event": "^12.6.0", "axios": "^0.21.1", + "express": "^4.17.1", "react": "^17.0.1", "react-dom": "^17.0.1", "react-router-dom": "^5.2.0", @@ -15,7 +16,7 @@ "web-vitals": "^0.2.4" }, "scripts": { - "start": "set PORT=3000 && react-scripts start", + "start": "node server/server.js", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" diff --git a/diskuy/public/index.html b/diskuy/public/index.html index cf78dad22ae76379c8ba978e8fb1869be18a182f..9ffc7ed517408d6562461554f8c2e6c2f80211e5 100644 --- a/diskuy/public/index.html +++ b/diskuy/public/index.html @@ -28,7 +28,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - <title>React App</title> + <title>Diskuy</title> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script> diff --git a/diskuy/server/server.js b/diskuy/server/server.js new file mode 100644 index 0000000000000000000000000000000000000000..bbafa6a783e3338769a52c4e57f77f6c46873c68 --- /dev/null +++ b/diskuy/server/server.js @@ -0,0 +1,16 @@ +const path = require('path') +const express = require('express') + +const port = process.env.PORT || 3000 +const app = express() +const publicPath = path.join(__dirname, '..', 'build') + +app.use(express.static(publicPath)) + +app.get('*', (req, res) => { + res.sendFile(path.join(publicPath, 'index.html')) +}) + +app.listen(port, () => { + console.log(`Server is up on port ${port}`) +}) diff --git a/diskuy/src/services/api_link.js b/diskuy/src/services/api_link.js index 01a47682406945dbc3ce37922e298107285cce17..eaec34c421d7ac2c84f833a8d2bd9109a1dfb92e 100644 --- a/diskuy/src/services/api_link.js +++ b/diskuy/src/services/api_link.js @@ -1 +1 @@ -export const API_URL = 'http://localhost:4000/api' \ No newline at end of file +export const API_URL = 'https://diskuyapi.herokuapp.com/api' \ No newline at end of file