Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

app controller with project information

Blue Mouse8f95060fad68
diff --git a/apps/production/src/app.controller.ts b/apps/production/src/app.controller.ts
new file mode 100644
index 000000000..dfedefb2c
--- /dev/null
+++ b/apps/production/src/app.controller.ts
@@ -0,0 +1,16 @@
+import { Get, Controller } from '@nestjs/common'
+
+const DEPLOYMENT_INFORMATION = {
+ name: 'Swetrix API',
+ repository: 'https://github.com/swetrix/swetrix-api',
+ documentation: 'https://docs.swetrix.com',
+ homepage: 'https://swetrix.com',
+}
+
+@Controller()
+export class AppController {
+ @Get()
+ root(): any {
+ return DEPLOYMENT_INFORMATION
+ }
+}
diff --git a/apps/production/src/app.module.ts b/apps/production/src/app.module.ts
index 263468e2e..73e905b5e 100644
--- a/apps/production/src/app.module.ts
+++ b/apps/production/src/app.module.ts
@@ -24,6 +24,7 @@ import { CaptchaModule } from './captcha/captcha.module'
import { OgImageModule } from './og-image/og-image.module'
import { IntegrationsModule } from './integrations/integrations.module'
import { HealthModule } from './health/health.module'
+import { AppController } from './app.controller'
const modules = [
ConfigModule.forRoot({
@@ -84,5 +85,6 @@ const modules = [
...(process.env.ENABLE_INTEGRATIONS === 'true' ? [IntegrationsModule] : []),
...(process.env.IS_MASTER_NODE === 'true' ? [TaskManagerModule] : []),
],
+ controllers: [AppController],
})
export class AppModule {}
diff --git a/apps/selfhosted/src/app.controller.ts b/apps/selfhosted/src/app.controller.ts
new file mode 100644
index 000000000..dfedefb2c
--- /dev/null
+++ b/apps/selfhosted/src/app.controller.ts
@@ -0,0 +1,16 @@
+import { Get, Controller } from '@nestjs/common'
+
+const DEPLOYMENT_INFORMATION = {
+ name: 'Swetrix API',
+ repository: 'https://github.com/swetrix/swetrix-api',
+ documentation: 'https://docs.swetrix.com',
+ homepage: 'https://swetrix.com',
+}
+
+@Controller()
+export class AppController {
+ @Get()
+ root(): any {
+ return DEPLOYMENT_INFORMATION
+ }
+}
diff --git a/apps/selfhosted/src/app.module.ts b/apps/selfhosted/src/app.module.ts
index 89832f892..910a606e3 100644
--- a/apps/selfhosted/src/app.module.ts
+++ b/apps/selfhosted/src/app.module.ts
@@ -11,6 +11,7 @@ import { TaskManagerModule } from './task-manager/task-manager.module'
import { PingModule } from './ping/ping.module'
import { getI18nConfig } from './configs'
import { AuthModule } from './auth/auth.module'
+import { AppController } from './app.controller'
const imports = [
ConfigModule.forRoot({
@@ -32,5 +33,6 @@ const imports = [
@Module({
imports,
+ controllers: [AppController],
})
export class AppModule {}