Skip to content

Commit

Permalink
/api/plans
Browse files Browse the repository at this point in the history
  • Loading branch information
daneedev committed Nov 1, 2024
1 parent facd7f1 commit 4343a86
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions routes/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const express = require('express');
const router = express.Router();
const { Op } = require('sequelize');
const Plan = require('../models/Plan');

router.get('/plans', async (req, res) => {
const { egg, node } = req.query;

const plans = await Plan.findAll({
where: {
eggs: {
[Op.like]: `%${egg}%`
},
nodes: {
[Op.like]: `%${node}%`
}
}
});
res.json(plans);

})

module.exports = router;

0 comments on commit 4343a86

Please sign in to comment.