wirejs-deploy-amplify-basic 0.0.19-alpha → 0.0.20-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -194,11 +194,10 @@ async function postData(request) {
194
194
  });
195
195
  };
196
196
 
197
- async function handleApiResponse(req, res) {
197
+ async function tryAPIPath(req, res) {
198
198
  if (!API_URL) {
199
199
  logger.error('Tried to proxy without API_URL config.');
200
- res.statusCode = 500;
201
- res.end('500 - Internal Server Error');
200
+ return false;
202
201
  }
203
202
  return proxyRequest(req, res, API_URL);
204
203
  }
@@ -226,6 +225,8 @@ async function proxyRequest(req, res, targetUrl) {
226
225
  res.statusCode = 500;
227
226
  res.end('Internal Server Error');
228
227
  }
228
+
229
+ return true;
229
230
  }
230
231
 
231
232
  /**
@@ -239,6 +240,7 @@ async function handleRequest(req, res) {
239
240
 
240
241
  if (await trySSRScriptPath(req, res)) return;
241
242
  if (await trySSRPath(req, res)) return;
243
+ if (await tryAPIPath(req, res)) return;
242
244
 
243
245
  // if we've made it this far, we don't have what you're looking for
244
246
  res.statusCode = '404';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-deploy-amplify-basic",
3
- "version": "0.0.19-alpha",
3
+ "version": "0.0.20-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",