Commit d58afb829f3848d71269a7c3cfd3b94ba985634b
1 parent
43555fba9f
Exists in
master
consulta post, devuelve articulos2
Showing
1 changed file
with
5 additions
and
3 deletions
 
Show diff stats
rutas/articulos.js
| ... | ... | @@ -13,14 +13,16 @@ const Articulo = bookshelf.Model.extend({ | 
| 13 | 13 | } | 
| 14 | 14 | }); | 
| 15 | 15 | |
| 16 | -router.get('/articulos/:page', (req, res) => { | |
| 16 | +router.post('/articulos', (req, res) => { | |
| 17 | 17 | |
| 18 | 18 | Articulo | 
| 19 | - .query(() => {}) | |
| 19 | + .query((qb) => { | |
| 20 | + qb.where(`DET_LAR`, `like`, `%${req.body.search}%`); | |
| 21 | + }) | |
| 20 | 22 | .orderBy('id') | 
| 21 | 23 | .fetchPage({ | 
| 22 | 24 | pageSize: 150, | 
| 23 | - page: req.params.page, | |
| 25 | + page: req.body.page, | |
| 24 | 26 | withRelated: ['imagenes'] | 
| 25 | 27 | }) | 
| 26 | 28 | .then(data => { |