質問編集履歴

2

index.jsを追加

2023/09/18 07:11

投稿

test-app
test-app

スコア1

test CHANGED
File without changes
test CHANGED
@@ -60,6 +60,31 @@
60
60
  2023-09-18T04:51:25.371635+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=xxxxxxx.herokuapp.com request_id=3c078552-a36e-4cba-bc5f-aa1fdfe21750 fwd="124.144.141.110" dyno= connect= service= status=503 bytes= protocol=https```
61
61
 
62
62
  ### 該当のソースコード
63
+
64
+ --- index.js
65
+
66
+ const he = require('he');
67
+ const express = require('express');
68
+ const path = require('path');
69
+ const cors = require('cors');
70
+ const axios = require('axios');
71
+ const database = require('./database');
72
+
73
+ const app = express();
74
+
75
+ app.use(cors());
76
+ app.use(express.json());
77
+
78
+ app.use(express.static(path.join(__dirname, '..', 'build')));
79
+
80
+ app.get('*', (req, res) => {
81
+ res.sendFile(path.join(__dirname, '..', 'build', 'index.html'));
82
+ });
83
+
84
+ const PORT = process.env.PORT || 3001;
85
+
86
+ app.listen(PORT, () => console.log(`Server listening on port ${PORT}`));
87
+
63
88
 
64
89
  --- server配下のpackage.json
65
90
  {

1

.gitignoreを追加

2023/09/18 05:29

投稿

test-app
test-app

スコア1

test CHANGED
File without changes
test CHANGED
@@ -150,6 +150,34 @@
150
150
 
151
151
  --- Procfile
152
152
  web: node server/index.js
153
+
154
+ --- .gitignore
155
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
156
+
157
+ # dependencies
158
+ /node_modules
159
+ /server/node_modules
160
+ /.pnp
161
+ .pnp.js
162
+
163
+ # testing
164
+ /coverage
165
+
166
+ # production
167
+ /build
168
+
169
+ # misc
170
+ .DS_Store
171
+ .env
172
+ .env.local
173
+ .env.development.local
174
+ .env.test.local
175
+ .env.production.local
176
+ /server/.env
177
+
178
+ npm-debug.log*
179
+ yarn-debug.log*
180
+ yarn-error.log*
153
181
  ```
154
182
 
155
183
  ### 試したこと