hasancode-api-docs 1.0.14 → 1.0.16

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.
@@ -202,7 +202,13 @@ class ApiDoc {
202
202
  */
203
203
  middleware() {
204
204
  const router = (0, express_1.Router)();
205
- // 1. Serve config.json
205
+ // 1. Direct redirect to overview from the root documentation path
206
+ // Using 302 (Found) to avoid browser-cached permanent redirects (301)
207
+ router.get([this.DOCS_PATH, `${this.DOCS_PATH}/`], (req, res) => {
208
+ const cleanBase = (req.baseUrl + this.DOCS_PATH).replace(/\/+$/, "");
209
+ res.redirect(302, `${cleanBase}/overview`);
210
+ });
211
+ // 2. Serve config.json
206
212
  router.get(`${this.DOCS_PATH}/config.json`, this.serveConfig.bind(this));
207
213
  // 3. Serve static assets with explicit MIME types
208
214
  router.use(`${this.DOCS_PATH}/assets`, (req, res, next) => {
@@ -254,7 +260,7 @@ class ApiDoc {
254
260
  ? this.DOCS_PATH
255
261
  : `/${this.DOCS_PATH}`;
256
262
  const fullPath = (mountPath + docsPath).replace(/\/+$/, "");
257
- const baseTag = `<base href="${fullPath}">`;
263
+ const baseTag = `<base href="${fullPath}/">`;
258
264
  // Insert or replace base tag
259
265
  if (html.includes("<base ")) {
260
266
  html = html.replace(/<base[^>]*>/i, baseTag);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hasancode-api-docs",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "A simple and easy to use API documentation generator for Express.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",