just-another-http-api 1.4.3 → 1.4.4

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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/api.js +5 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -90,6 +90,7 @@ The HTTP API module requires a configuration object to initialize. Here's a brea
90
90
  - `jwtRefreshExpiresIn`: Expiry time for refresh tokens.
91
91
  - `docRoot`: Directory containing route definitions.
92
92
  - `port`: Port number for the server.
93
+ - `host`: Hostname/interface to bind the server to (e.g. `localhost`, `127.0.0.1`, `0.0.0.0`).
93
94
  - `logs`: Enable or disable logging. Accepts a function or false.
94
95
  - `uploads`: File upload configuration.
95
96
  - `enabled`: Enable or disable file uploads.
@@ -113,6 +114,7 @@ const getConfig = async () => {
113
114
  cache: {...}, // See Caching section for details
114
115
  auth: {...}, // See Authentication section for details
115
116
  docRoot: './routes', // This is where you store your endpoint handlers
117
+ host: 'localhost',
116
118
  port: 4500,
117
119
  logs: false, // Accepts function or false
118
120
  uploads: {...}, // See Uploads section for details
package/api.js CHANGED
@@ -18,7 +18,10 @@ module.exports = async ( config, _app = null ) => {
18
18
  const endpoints = await loadEndpoints ( config );
19
19
  endpoints.forEach ( endpoint => registerEndpoint ( app, endpoint, config ) );
20
20
 
21
- await app.listen ( { port: process.env.PORT || config?.port || 4001 } );
21
+ await app.listen ( {
22
+ host: process.env.HOST || config?.host || 'localhost',
23
+ port: process.env.PORT || config?.port || 4001
24
+ } );
22
25
 
23
26
  return app;
24
27
  };
@@ -306,4 +309,4 @@ const recursiveReadDir = async ( docRoot ) => {
306
309
  console.error ( 'JustAnother: Failed to load your routes directory for generating endpoints.' );
307
310
  throw e;
308
311
  }
309
- };
312
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "just-another-http-api",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "A framework built on top of fastify aimed at removing the need for any network or server configuration. ",
5
5
  "homepage": "https://github.com/OllieEdge/just-another-http-api#readme",
6
6
  "repository": {