@seas-computing/nestjs-healthcheck 0.0.13-2 → 0.0.13
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/README.md +22 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,12 +16,25 @@ npm install @seas-computing/nestjs-healthcheck
|
|
|
16
16
|
To add the nestjs healthcheck system, you should make the following changes in the consuming application's `AppModule` (or other root module):
|
|
17
17
|
- be sure that the `ConfigModule` is at the top of the imports list
|
|
18
18
|
- import and register the `HealthcheckModule` using `registerAsync`
|
|
19
|
-
- import `TypeOrmModule` and `
|
|
19
|
+
- import `TypeOrmModule` and `RedisModule`
|
|
20
20
|
|
|
21
21
|
In the `ConfigService`, configuration values (i.e. `HealthcheckModuleOptions`) should be made available and passed as options to the `HealthcheckModule`.
|
|
22
22
|
|
|
23
|
-
Example `app.module`
|
|
23
|
+
Example `app.module` based on [oap-grad-database](https://github.huit.harvard.edu/SEAS/oap-grad-database/blob/develop/src/server/app.module.ts):
|
|
24
24
|
```ts
|
|
25
|
+
import { MiddlewareConsumer, Module, NestModule, RequestMethod } from '@nestjs/common';
|
|
26
|
+
import { LogMiddleware, LogModule } from '@seas-computing/nestjs-logging';
|
|
27
|
+
import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm';
|
|
28
|
+
import { HarvardKeyModule } from '@seas-computing/nestjs-harvard-key';
|
|
29
|
+
import { SessionModule, NestSessionOptions } from 'nestjs-session';
|
|
30
|
+
import { RedisStore } from 'connect-redis';
|
|
31
|
+
import { RedisModule, RedisModuleOptions } from '@nestjs-modules/ioredis';
|
|
32
|
+
import { HealthcheckModule, HealthcheckModuleOptions } from '@seas-computing/nestjs-healthcheck';
|
|
33
|
+
import Redis from 'iovalkey';
|
|
34
|
+
import { ConfigModule } from './config/config.module';
|
|
35
|
+
import { ConfigService } from './config/config.service';
|
|
36
|
+
import { HealthCheckModule } from './healthCheck/healthCheck.module';
|
|
37
|
+
|
|
25
38
|
@Module({
|
|
26
39
|
imports: [
|
|
27
40
|
ConfigModule, // Ensure this is at the top
|
|
@@ -77,13 +90,6 @@ Example `app.module` from [oap-grad-database](https://github.huit.harvard.edu/SE
|
|
|
77
90
|
},
|
|
78
91
|
}),
|
|
79
92
|
}),
|
|
80
|
-
AdvisorModule,
|
|
81
|
-
StudentModule,
|
|
82
|
-
StudentToAdvisorModule,
|
|
83
|
-
NoteModule,
|
|
84
|
-
ThesisModule,
|
|
85
|
-
DegreeProgramModule,
|
|
86
|
-
MilestonesModule,
|
|
87
93
|
HealthcheckModule.registerAsync({ // Add HealthcheckModule
|
|
88
94
|
imports: [ConfigModule],
|
|
89
95
|
inject: [ConfigService],
|
|
@@ -149,7 +155,7 @@ public get healthcheckConfig(): HealthcheckModuleOptions {
|
|
|
149
155
|
oidcCheckURL: this.oidcCheckURL,
|
|
150
156
|
dbOptions: this.dbOptions,
|
|
151
157
|
valkeyURL: this.valkeyURL,
|
|
152
|
-
|
|
158
|
+
buildVersion: this.buildVersion,
|
|
153
159
|
strategy: this.isProduction
|
|
154
160
|
? HEALTH_STRATEGY_NAME.HEALTHCHECK
|
|
155
161
|
: HEALTH_STRATEGY_NAME.DEV,
|
|
@@ -159,7 +165,12 @@ public get healthcheckConfig(): HealthcheckModuleOptions {
|
|
|
159
165
|
|
|
160
166
|
## Sample Response
|
|
161
167
|
|
|
162
|
-
|
|
168
|
+
After running
|
|
169
|
+
```
|
|
170
|
+
curl http://127.0.0.1:3001/[yourAppName]/health-check
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
from the cli, you should receive a response that looks like this:
|
|
163
174
|
|
|
164
175
|
```json
|
|
165
176
|
{
|