@frozencrow/create-api 0.1.4 → 0.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frozencrow/create-api",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "Scaffold a new API project powered by @frozencrow/api-core",
5
5
  "license": "MIT",
6
6
  "author": "Eric Uldall",
@@ -22,7 +22,8 @@ Configuration uses the Feathers config module (no `.env` files):
22
22
  was scaffolded with a strong `authentication.secret` here.
23
23
  - `config/test.json` — used when `NODE_ENV=test`.
24
24
  - `config/custom-environment-variables.json` — maps env vars (`AUTH_SECRET`,
25
- `MONGODB_URI`, `PORT`, …) onto config for production.
25
+ `MONGODB_URI`, `PORT`, `ORIGINS`, …) onto config for production. Note
26
+ `ORIGINS` is JSON-formatted, e.g. `ORIGINS=["https://app.example.com"]`.
26
27
 
27
28
  Generate a fresh secret any time with `npm run secret -- --write` (updates
28
29
  `config/local.json`), or set `AUTH_SECRET` in the environment for production.
@@ -65,5 +66,6 @@ npm test # needs a MongoDB on localhost:27017
65
66
  ## Production
66
67
 
67
68
  - Set a strong `AUTH_SECRET` (the app refuses to boot in production without one).
68
- - Set `ORIGINS` to your allowed browser origins.
69
+ - Set `ORIGINS` to your allowed browser origins (JSON array, e.g.
70
+ `ORIGINS=["https://app.example.com"]`).
69
71
  - `npm run compile && npm start`, or build the Docker image.
@@ -2,6 +2,10 @@
2
2
  "port": "PORT",
3
3
  "mongodb": "MONGODB_URI",
4
4
  "clientHost": "CLIENT_HOST",
5
+ "origins": {
6
+ "__name": "ORIGINS",
7
+ "__format": "json"
8
+ },
5
9
  "authentication": {
6
10
  "secret": "AUTH_SECRET"
7
11
  },
@@ -11,7 +11,8 @@ services:
11
11
  - MONGODB_URI=mongodb://mongodb:27017/my-api
12
12
  - MAIL_HOST=smtp4dev
13
13
  - MAIL_PORT=25
14
- - ORIGINS=http://localhost:5173
14
+ # ORIGINS is JSON-formatted (see config/custom-environment-variables.json)
15
+ - ORIGINS=["http://localhost:5173"]
15
16
  # Override with a strong value in any non-local environment.
16
17
  - AUTH_SECRET=dev-only-secret-change-me-32-chars!!
17
18
  depends_on:
@@ -19,7 +19,7 @@
19
19
  "config": "3.3.9"
20
20
  },
21
21
  "dependencies": {
22
- "@frozencrow/api-core": "^0.1.4",
22
+ "@frozencrow/api-core": "^0.2.0",
23
23
  "@feathersjs/configuration": "^5.0.37",
24
24
  "@feathersjs/feathers": "^5.0.37",
25
25
  "@feathersjs/mongodb": "^5.0.37",
@@ -26,4 +26,11 @@ describe('Feathers application tests', () => {
26
26
  assert.strictEqual(data.code, 404)
27
27
  assert.strictEqual(data.name, 'NotFound')
28
28
  })
29
+
30
+ it('attaches socket.io even with seeding enabled', async () => {
31
+ // Regression test: the core's seed setup hook must call next(), or the
32
+ // setup chain stops and @feathersjs/socketio never attaches to the HTTP
33
+ // server (this config runs with seed: true).
34
+ assert.ok((app as any).io, 'app.io should be set after listen()')
35
+ })
29
36
  })