@stanlemon/server 0.3.47 → 0.4.1

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.
package/app.test.js CHANGED
@@ -49,4 +49,12 @@ describe("/app", () => {
49
49
  expect(response.status).toEqual(200);
50
50
  expect(response.body).toEqual({ hello: "Henry" });
51
51
  });
52
+
53
+ it("GET 404 on undefined api path", async () => {
54
+ const response = await request(app)
55
+ .get("/not-found")
56
+ .set("Accept", "application/json");
57
+
58
+ expect(response.status).toEqual(404);
59
+ });
52
60
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stanlemon/server",
3
- "version": "0.3.47",
3
+ "version": "0.4.1",
4
4
  "description": "A basic express web server setup.",
5
5
  "author": "Stan Lemon <stanlemon@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -24,10 +24,10 @@
24
24
  "compression": "^1.8.0",
25
25
  "cookie-parser": "^1.4.7",
26
26
  "dotenv": "16.4.7",
27
- "express": "^4.21.2",
27
+ "express": "^5.1.0",
28
28
  "express-rate-limit": "^7.5.0",
29
29
  "helmet": "^8.1.0",
30
- "http-proxy-middleware": "^3.0.3",
30
+ "http-proxy-middleware": "^3.0.4",
31
31
  "joi": "^17.13.3",
32
32
  "lodash": "^4.17.21",
33
33
  "lodash-es": "^4.17.21",
@@ -75,7 +75,7 @@ export default function createAppServer(options) {
75
75
  console.info("Proxying webpack dev server");
76
76
 
77
77
  app.get(
78
- "/static/*",
78
+ "/static/*splat",
79
79
  createProxyMiddleware({
80
80
  target: webpack,
81
81
  changeOrigin: true,
@@ -120,25 +120,25 @@ export default function createAppServer(options) {
120
120
  app.spa = () => {
121
121
  if (useWebpack) {
122
122
  app.get(
123
- "*",
123
+ "/*splat",
124
124
  createProxyMiddleware({
125
125
  target: webpack,
126
126
  changeOrigin: true,
127
127
  })
128
128
  );
129
129
  } else {
130
- app.get(`*`, function (req, res, next) {
130
+ app.get(`/*splat`, function (req, res, next) {
131
131
  res.sendFile(path.resolve("./", "dist", "index.html"));
132
132
  });
133
133
  }
134
134
  };
135
135
 
136
- app.catch404s = (path = "/*") => {
136
+ app.catch404s = (path = "/") => {
137
137
  const router = Router();
138
138
  router.use((req, res, next) => {
139
139
  res.status(404).json({ error: "Not Found" });
140
140
  });
141
- app.use(path, router);
141
+ app.use(`${path}*splat`, router);
142
142
  };
143
143
 
144
144
  // If we're set to start. Btw we never start in test.