diff --git a/frontend/index.js b/frontend/index.js index 16a3229..91abe8a 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -12,10 +12,15 @@ app.get('/', (req, res) => { res.sendFile(path.join(__dirname, 'public', 'index.html')); }); +app.get('/health', (req, res) => { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify({ state: 'healthy' })); +}); + // Catch-all route for shortened URLs - redirect to API app.get('/:shortId', (req, res) => { const { shortId } = req.params; - + // Check if it looks like a short ID (7 characters alphanumeric) if (shortId.length === 7 && /^[a-zA-Z0-9]+$/.test(shortId)) { // Redirect to the API endpoint for this short ID diff --git a/provider.yml b/provider.yml new file mode 100644 index 0000000..0a09704 --- /dev/null +++ b/provider.yml @@ -0,0 +1,52 @@ +name: url-shortener +schemaVersion: v0 +backend: + landscape: + gitUrl: https://github.com/codesphere-cloud/nodejs-template +author: Codesphere Test +capabilities: + highAvailability: false + pause: false + backups: false + pointInTimeRecovery: false +category: Utilities +description: | + A complete Codesphere app template featuring a URL shortener service with QR code generation, + built with NodeJS and Express using a two-service architecture. +displayName: URL Shortener +iconUrl: https://cloud.codesphere.com/ide/assets/favicon-32x32.png +configSchema: {} +detailsSchema: + type: object + properties: + hostname: + type: string + readOnly: true + service_url_frontend_3000: + type: string + readOnly: true + statusUrl: + type: string + readOnly: true + default: '${{ .hostname }}/health' + status: + type: 'object' + properties: + state: + type: string + x-endpoint: '${{ .statusUrl }}' +secretsSchema: {} +plans: + - id: 0 + name: default + description: default + parameters: {} +versions: + 0.0.1-dev: + ciProfile: dev + gitRef: 158a6cd613db41bca43e6c28000d0f79832e5155 + description: Fix plan IDs (use plan ids that actually exist). Dev Profile + 0.0.1: + ciProfile: prod + gitRef: 158a6cd613db41bca43e6c28000d0f79832e5155 + description: Fix plan IDs (use plan ids that actually exist). Prod Profile