-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from smdthiranjaya/dev
Clean and add comments for the whole project.
- Loading branch information
Showing
10 changed files
with
67 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
const { Pool } = require('pg'); | ||
const { DATABASE_URL } = require('../config'); | ||
|
||
// Create a new pool instance with connection settings | ||
const pool = new Pool({ | ||
// Use the DATABASE_URL for connection string | ||
connectionString: DATABASE_URL, | ||
// Disable SSL to allow connections from localhost | ||
ssl: { | ||
rejectUnauthorized: false | ||
} | ||
}); | ||
|
||
// Export the pool for database operations elsewhere in the application | ||
module.exports = pool; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
// Import the addSubscription function from the subscription controller | ||
const { addSubscription } = require('../controllers/subscriptionController'); | ||
|
||
// Define a POST route for subscriptions | ||
router.post('/subscribe', addSubscription); | ||
|
||
// Export the router for use in other parts of the application | ||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
const swaggerJsDoc = require('swagger-jsdoc'); | ||
|
||
// Define Swagger options for API documentation | ||
const swaggerOptions = { | ||
definition: { | ||
openapi: '3.0.0', | ||
// Provide basic information about the API (title, version, description) | ||
info: { | ||
title: 'Geo 360 Live Weather API', | ||
version: '1.0.0', | ||
description: 'A simple Express Weather API' | ||
}, | ||
// Define the server(s) the API is available on | ||
servers: [ | ||
{ | ||
url: 'https://www.geo360live.tech' | ||
} | ||
], | ||
}, | ||
// Specify the path(s) to files containing Swagger annotations for routes | ||
apis: ['./src/routes/*.js'], | ||
}; | ||
|
||
module.exports = swaggerJsDoc(swaggerOptions); | ||
module.exports = swaggerJsDoc(swaggerOptions); |