Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ A RESTful API that serves **hierarchical location data** of the Philippines —

- REST API: <https://ph-regions.vercel.app/api>
- API documentation
- Static: <https://ph-regions.vercel.app>
- Interactive: <https://ph-regions.vercel.app/docs>
- Interactive (Scalar): <https://ph-regions.vercel.app>
- Interactive (Swagger UI): <https://ph-regions.vercel.app/docs>
- Static: <https://ph-regions.vercel.app/docs/redoc>


<br>

Expand Down
6 changes: 0 additions & 6 deletions server/nodemon.debug.json

This file was deleted.

6 changes: 0 additions & 6 deletions server/nodemon.json

This file was deleted.

299 changes: 94 additions & 205 deletions server/package-lock.json

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ph-regions",
"version": "1.1.3",
"version": "1.2.0",
"type": "module",
"description": "A RESTful API that serves hierarchical location data of the Philippines — including regions, provinces, municipalities, and a randomly generated number of barangays per municipality.",
"main": "dist/server.js",
Expand All @@ -9,18 +9,18 @@
},
"scripts": {
"start": "node dist/server.js",
"dev": "nodemon",
"dev": "tsx watch src/server.ts",
"transpile": "tsc -p tsconfig.json && tsc-alias",
"transpile:noemit": "tsc -p tsconfig.json --noEmit",
"docs:swagger": "tsx ./src/scripts/copyFiles/main.ts",
"docs:gen": "tsx --import ./src/scripts/openapi/zod-extend.ts ./src/scripts/openapi/main.ts",
"docs:build": "npm run docs:gen && redocly build-docs ./public/openapi.yaml -o public/index.html",
"docs:build": "npm run docs:gen && redocly build-docs ./public/openapi.yaml -o public/docs/redoc/index.html",
"build": "npm run transpile && npm run docs:build && npm run docs:swagger",
"watch": "tsc -p tsconfig.json --watch",
"lint": "eslint \"src/**/*.ts\" *.mjs",
"lint:fix": "eslint \"src/**/*.ts\" *.mjs --fix",
"seed": "tsx ./src/scripts/seed/main.ts",
"docker:dev": "nodemon --config nodemon.debug.json",
"docker:dev": "tsx watch --inspect-brk=0.0.0.0:9229 src/server.ts",
"docker:seed:debug": "tsx --inspect=0.0.0.0:9229 ./src/scripts/seed/main.ts",
"docker:watch:win": "tsc -p tsconfig.json --watch --watchFile dynamicPriorityPolling --watchDirectory dynamicPriorityPolling",
"info": "tsx ./src/scripts/envinfo.ts"
Expand All @@ -33,27 +33,26 @@
"dotenv": "^17.4.2",
"express": "^5.2.1",
"express-rate-limit": "^8.3.2",
"mongoose": "^9.4.1",
"mongoose": "^9.5.0",
"swagger-ui-express": "^5.0.1",
"zod": "^4.3.6"
},
"devDependencies": {
"@asteasolutions/zod-to-openapi": "^8.5.0",
"@eslint/js": "^10.0.1",
"@redocly/cli": "^2.28.1",
"@redocly/cli": "^2.29.1",
"@types/cookie-parser": "^1.4.10",
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/node": "^25.6.0",
"@types/swagger-ui-express": "^4.1.8",
"eslint": "^10.2.1",
"globals": "^17.5.0",
"nodemon": "^3.1.14",
"ph-municipalities": "^1.4.7",
"tsc-alias": "^1.8.16",
"tsx": "^4.21.0",
"typescript": "^6.0.3",
"typescript-eslint": "^8.58.2",
"typescript-eslint": "^8.59.0",
"yaml": "^2.8.3"
}
}
623 changes: 623 additions & 0 deletions server/public/docs/redoc/index.html

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions server/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>PH Regions API Docs (Scalar)</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div id="app"></div>

<!-- Load the Script -->
<script
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.52.5"
integrity="sha384-CgK3WZXj+WGIkrmOoRUQVH/vp8sAA8d4DgYGSTK9DybAd4B7j9Ami1CbKXf+Q+pe"
crossorigin="anonymous"
></script>

<!-- Initialize the Scalar API Reference -->
<script>
Scalar.createApiReference('#app', {
// The URL of the OpenAPI/Swagger document
url: '/openapi.json',
// Avoid CORS issues
proxyUrl: 'https://proxy.scalar.com',
})
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions server/public/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"license": {
"name": "MIT"
},
"description": "**💡About** \n\n A RESTful API that serves hierarchical location data of the Philippines — including regions, provinces, municipalities, and a randomly generated number of barangays per municipality for testing purposes. \n\n **⚠️ Important** <br><br> This API is intended for testing and simulating RESTful API requests from client applications. \n **Note:** The location data may be outdated and does not reflect the most current official records. \n\n **🧩 Alternate Docs** <ul><li>Interactive API documentation (Swagger UI): [http://localhost:3001/docs](http://localhost:3001/docs)</li></ul>",
"description": "**💡About** \n\n A RESTful API that serves hierarchical location data of the Philippines — including regions, provinces, municipalities, and a randomly generated number of barangays per municipality for testing purposes. \n\n **⚠️ Important** <br><br> This API is intended for testing and simulating RESTful API requests from client applications. \n **Note:** The location data may be outdated and does not reflect the most current official records. \n\n **🧩 Alternate API Documentation** <ul><li>Scalar: [http://localhost:3001](http://localhost:3001)</li><li>Swagger UI: [http://localhost:3001/docs](http://localhost:3001/docs)</li><li>Redocly CLI: [http://localhost:3001/docs/redoc](http://localhost:3001/docs/redoc)</li></ul>",
"x-logo": {
"url": "./assets/images/logo_ph_regions_01.png",
"url": "../../assets/images/logo_ph_regions_01.png",
"altText": "PH Regions logo"
}
},
Expand Down
4 changes: 2 additions & 2 deletions server/public/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ info:
**⚠️ Important** <br><br> This API is intended for testing and simulating RESTful API requests from client applications.
**Note:** The location data may be outdated and does not reflect the most current official records.

**🧩 Alternate Docs** <ul><li>Interactive API documentation (Swagger UI): [http://localhost:3001/docs](http://localhost:3001/docs)</li></ul>
**🧩 Alternate API Documentation** <ul><li>Scalar: [http://localhost:3001](http://localhost:3001)</li><li>Swagger UI: [http://localhost:3001/docs](http://localhost:3001/docs)</li><li>Redocly CLI: [http://localhost:3001/docs/redoc](http://localhost:3001/docs/redoc)</li></ul>
x-logo:
url: ./assets/images/logo_ph_regions_01.png
url: ../../assets/images/logo_ph_regions_01.png
altText: PH Regions logo
tags:
- name: Islands
Expand Down
4 changes: 2 additions & 2 deletions server/src/scripts/openapi/docs/api.info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export const API_INFO = {
contact: { name: 'PH Regions', url: 'https://github.com/weaponsforge/ph-regions' },
license: { name: 'MIT' },

description: `**💡About** \n\n A RESTful API that serves hierarchical location data of the Philippines — including regions, provinces, municipalities, and a randomly generated number of barangays per municipality for testing purposes. \n\n **⚠️ Important** <br><br> This API is intended for testing and simulating RESTful API requests from client applications. \n **Note:** The location data may be outdated and does not reflect the most current official records. \n\n **🧩 Alternate Docs** <ul><li>Interactive API documentation (Swagger UI): [${BASE_API_URL}/docs](${BASE_API_URL}/docs)</li></ul>`,
description: `**💡About** \n\n A RESTful API that serves hierarchical location data of the Philippines — including regions, provinces, municipalities, and a randomly generated number of barangays per municipality for testing purposes. \n\n **⚠️ Important** <br><br> This API is intended for testing and simulating RESTful API requests from client applications. \n **Note:** The location data may be outdated and does not reflect the most current official records. \n\n **🧩 Alternate API Documentation**\n\n- Interactive (Scalar): [${BASE_API_URL}](${BASE_API_URL})\n- Interactive (Swagger UI): [${BASE_API_URL}/docs](${BASE_API_URL}/docs)\n- Static (Redocly CLI): [${BASE_API_URL}/docs/redoc](${BASE_API_URL}/docs/redoc)`,

'x-logo': {
url: './assets/images/logo_ph_regions_01.png',
url: '../../assets/images/logo_ph_regions_01.png',
altText: 'PH Regions logo',
},
},
Expand Down
Loading