Skip to content

Commit d0448cb

Browse files
committed
category fix
1 parent bbf3158 commit d0448cb

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
coverage/
33
.idea/
44
.env
5-
github_token.txt
5+
github_token.txt
6+
google_oauth_client.json

config/db.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import mongoose from 'mongoose';
33
dotenv.config();
44
export default function connectDB() {
55
const url = process.env.MONGODB_URI;
6-
console.log(url)
6+
77
try {
88
mongoose.connect(url);
99
} catch (err) {
@@ -14,7 +14,7 @@ export default function connectDB() {
1414
const dbConnection = mongoose.connection;
1515

1616
dbConnection.once('open', () => {
17-
console.log(`Database connected: ${url}`);
17+
console.log(`Database connected`);
1818
});
1919

2020
dbConnection.on('error', (err) => {

controllers/posts-controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const getPostByCategoryHandler = async (req, res) => {
6565
const category = req.params.category;
6666
try {
6767
// Validation - check if category is valid
68+
console.log(validCategories, category)
6869
if (!validCategories.includes(category)) {
6970
return res.status(HTTP_STATUS.BAD_REQUEST).json({ message: RESPONSE_MESSAGES.POSTS.INVALID_CATEGORY });
7071
}

server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import connectDB from './config/db.js';
44
import cors from 'cors';
55
import compression from 'compression';
66
const app = express();
7-
const port = process.env.PORT || 5000;
7+
const port = process.env.PORT || 5050;
88

99
app.use(express.json());
1010
app.use(express.urlencoded({ extended: true }));

utils/constants.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
export const validCategories = [
2-
'Travel',
3-
'Nature',
4-
'City',
5-
'Adventure',
6-
'Beaches',
7-
'Landmarks',
8-
'Mountains',
2+
'Roteiro',
3+
'Europa',
4+
'Brasil',
5+
'Dicas',
6+
'Gastronomia',
7+
'Destino',
8+
'Nordeste',
9+
'Eventos',
10+
'América do Sul',
11+
'África',
12+
'Ásia'
913
];
1014
export const HTTP_STATUS = {
1115
OK: 200,

0 commit comments

Comments
 (0)