diff --git a/.gitignore b/.gitignore index f4fb0fd..551f00a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules coverage/ .idea/ .env -github_token.txt \ No newline at end of file +github_token.txt +google_oauth_client.json \ No newline at end of file diff --git a/config/db.js b/config/db.js index e90a90c..5e3c3b3 100644 --- a/config/db.js +++ b/config/db.js @@ -3,7 +3,7 @@ import mongoose from 'mongoose'; dotenv.config(); export default function connectDB() { const url = process.env.MONGODB_URI; - console.log(url) + try { mongoose.connect(url); } catch (err) { @@ -14,7 +14,7 @@ export default function connectDB() { const dbConnection = mongoose.connection; dbConnection.once('open', () => { - console.log(`Database connected: ${url}`); + console.log(`Database connected`); }); dbConnection.on('error', (err) => { diff --git a/controllers/posts-controller.js b/controllers/posts-controller.js index f084c99..c1c23f9 100644 --- a/controllers/posts-controller.js +++ b/controllers/posts-controller.js @@ -65,6 +65,7 @@ export const getPostByCategoryHandler = async (req, res) => { const category = req.params.category; try { // Validation - check if category is valid + console.log(validCategories, category) if (!validCategories.includes(category)) { return res.status(HTTP_STATUS.BAD_REQUEST).json({ message: RESPONSE_MESSAGES.POSTS.INVALID_CATEGORY }); } diff --git a/server.js b/server.js index 08298b5..1200012 100644 --- a/server.js +++ b/server.js @@ -4,7 +4,7 @@ import connectDB from './config/db.js'; import cors from 'cors'; import compression from 'compression'; const app = express(); -const port = process.env.PORT || 5000; +const port = process.env.PORT || 5050; app.use(express.json()); app.use(express.urlencoded({ extended: true })); diff --git a/utils/constants.js b/utils/constants.js index 15a70dc..3ab5b2e 100644 --- a/utils/constants.js +++ b/utils/constants.js @@ -1,11 +1,15 @@ export const validCategories = [ - 'Travel', - 'Nature', - 'City', - 'Adventure', - 'Beaches', - 'Landmarks', - 'Mountains', + 'Roteiro', + 'Europa', + 'Brasil', + 'Dicas', + 'Gastronomia', + 'Destino', + 'Nordeste', + 'Eventos', + 'América do Sul', + 'África', + 'Ásia' ]; export const HTTP_STATUS = { OK: 200,