Skip to content

Commit

Permalink
fix : response data changed
Browse files Browse the repository at this point in the history
  • Loading branch information
papicc45 committed Nov 30, 2023
1 parent ca919c1 commit d0682dd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1,314 deletions.
1 change: 1 addition & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const client = new Eureka({
},
});
client.start(); // Eureka 서버에 서비스를 등록

app.get('/health', (req, res) => {
res.json({status: 'UP'});
});
Expand Down
20 changes: 2 additions & 18 deletions controller/CategoryController.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
require('dotenv').config({ path: '/app/env' });
// require('dotenv').config();

const kafkaBrokers = process.env.KAFKA_BROKERS;
const { Kafka } = require('kafkajs');
const Category = require('../schemas/Category');
const Hashtag = require('../schemas/Hashtag');
exports.test = async (req ,res) => {
const categoryName = req.query.categoryName;
const temperature = Number(req.query.temperature);
console.log('categoryName : ', categoryName);
try {
const result = await Category.updateOne(
{ categoryName : categoryName, temperature: temperature },
{ $inc : { count : -1 } }
);

res.json({ result });
} catch (err) {
const message = `${err.name} : ${(parent)}`;
res.status(500).json({ message });
}
}
exports.getHashtagsInfo = async (req, res) => {
try {
const result = await Hashtag.find().sort('-count');
Expand All @@ -37,7 +21,7 @@ exports.getHashtagInfo = async (req, res) => {
try {
const result = await Hashtag.findOne({ tagName : tagName });

res.json({ result });
res.json({ count : result.count });
} catch (err) {
const message = `${err.name} : ${err.parent}`;
res.status(500).json({ message })
Expand Down Expand Up @@ -66,7 +50,7 @@ exports.getTop5 = async (req, res)=> {
$limit: 5
}
]);
res.json({ result });
res.json({ count : result.count });
} catch(err) {
const message = `${err.name} : ${err.parent}`;
res.status(500).json({ message })
Expand Down
Loading

0 comments on commit d0682dd

Please sign in to comment.