File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " api" ,
3- "version" : " 0.0.1 " ,
3+ "version" : " 0.1.0 " ,
44 "description" : " Express API with TypeScript" ,
55 "main" : " dist/index.js" ,
66 "scripts" : {
3838 "express-rate-limit" : " ^7.4.1" ,
3939 "helmet" : " ^7.1.0" ,
4040 "jsonwebtoken" : " ^9.0.2" ,
41+ "node-vibrant" : " ^4.0.2" ,
4142 "pg" : " ^8.16.3" ,
4243 "swagger-jsdoc" : " ^6.2.8" ,
4344 "swagger-ui-express" : " ^5.0.1" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,19 @@ import { config } from "../../core/config/env";
44import { logger } from "../../lib/utils" ;
55import path from "path" ;
66import os from "os" ;
7+ import { readFileSync } from "fs" ;
8+
9+ // Read version from package.json
10+ function getApiVersion ( ) : string {
11+ try {
12+ const packageJson = JSON . parse (
13+ readFileSync ( path . join ( __dirname , "../../../package.json" ) , "utf-8" )
14+ ) ;
15+ return packageJson . version ;
16+ } catch ( error ) {
17+ return "0.1.0" ; // Fallback version
18+ }
19+ }
720
821/// Get local machine IP address for LAN access
922function getLocalIpAddress ( ) : string {
@@ -22,13 +35,14 @@ function getLocalIpAddress(): string {
2235}
2336
2437const localIp = getLocalIpAddress ( ) ;
38+ const apiVersion = getApiVersion ( ) ;
2539
2640const options = {
2741 definition : {
2842 openapi : "3.0.0" ,
2943 info : {
3044 title : "DesterLib API" ,
31- version : "1.0.0" ,
45+ version : apiVersion ,
3246 description :
3347 "API documentation for DesterLib - A comprehensive media library management system" ,
3448 contact : {
@@ -93,6 +107,11 @@ const options = {
93107 type : "string" ,
94108 example : "OK" ,
95109 } ,
110+ version : {
111+ type : "string" ,
112+ example : "0.1.0" ,
113+ description : "API version" ,
114+ } ,
96115 timestamp : {
97116 type : "string" ,
98117 format : "date-time" ,
@@ -231,7 +250,7 @@ try {
231250 openapi : "3.0.0" ,
232251 info : {
233252 title : "DesterLib API" ,
234- version : "1.0.0" ,
253+ version : apiVersion ,
235254 description : "API documentation for DesterLib" ,
236255 } ,
237256 paths : { } ,
You can’t perform that action at this time.
0 commit comments