@loomcore/api 0.0.7 → 0.0.9

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.
@@ -7,23 +7,30 @@ import { errorHandler } from "../middleware/error-handler.js";
7
7
  import { ensureUserContext } from '../middleware/ensure-user-context.js';
8
8
  function setupExpressApp(db, config, setupRoutes) {
9
9
  const app = express();
10
+ console.log(`config: `, config);
11
+ console.log(`about to register health endpoint`);
10
12
  app.use((req, res, next) => {
11
13
  if (req.path !== '/api/health' && process.env.NODE_ENV !== 'test') {
12
14
  console.log(`[${new Date().toLocaleString('en-US', { timeZone: 'America/Chicago' })}] INCOMING REQUEST: ${req.method} ${req.path}`);
13
15
  }
14
16
  next();
15
17
  });
18
+ console.log(`registering third party middleware`);
16
19
  app.use(bodyParser.json());
17
20
  app.use(cookieParser());
18
21
  app.use(cors({
19
22
  origin: config.corsAllowedOrigins,
20
23
  credentials: true
21
24
  }));
25
+ console.log(`about to register ensureUserContext`);
22
26
  app.use(ensureUserContext);
27
+ console.log(`about to call setupRoutes`);
23
28
  setupRoutes(app, db, config);
29
+ console.log(`about to register * middleware for notfound paths`);
24
30
  app.all('*', async (req, res) => {
25
31
  throw new NotFoundError(`Requested path, ${req.path}, Not Found`);
26
32
  });
33
+ console.log(`about to register errorHandler middleware`);
27
34
  app.use(errorHandler);
28
35
  return app;
29
36
  }
@@ -2,5 +2,6 @@ export * from './address.utils.js';
2
2
  export * from './api.utils.js';
3
3
  export * from './conversion.utils.js';
4
4
  export * from './db.utils.js';
5
+ export * from './express.utils.js';
5
6
  export * from './password.utils.js';
6
7
  export * from './string.utils.js';
@@ -2,5 +2,6 @@ export * from './address.utils.js';
2
2
  export * from './api.utils.js';
3
3
  export * from './conversion.utils.js';
4
4
  export * from './db.utils.js';
5
+ export * from './express.utils.js';
5
6
  export * from './password.utils.js';
6
7
  export * from './string.utils.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcore/api",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "private": false,
5
5
  "description": "Loom Core Api - An opinionated Node.js api using Typescript, Express, and MongoDb",
6
6
  "scripts": {