change api route for getting posts by category

This commit is contained in:
Lacey Pevey
2023-05-16 11:17:47 -05:00
parent 6046366afc
commit 2b7e9ce077
2 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ export default (rootDirectory: string): Router | Router[] => {
})
// GET ALL BLOG POSTS BY CATEGORY
router.get("/store/blog/category-posts/:handle", cors(storeCorsOptions), async (req, res) => {
router.get("/store/blog/category/:handle/posts", cors(storeCorsOptions), async (req, res) => {
const blogService = req.scope.resolve("blogService")
blogService.getBlogPostsByCategoryHandle(req.params.handle).then((blog_posts) => {
return res.json(blog_posts)
+5 -4
View File
@@ -178,16 +178,17 @@
}
},
{
"name": "Get Blog Category By Handle Copy",
"name": "Get Blog Posts By Category Handle",
"request": {
"method": "GET",
"url": {
"raw": "http://localhost:9000/store/blog/category-posts/first-category",
"raw": "http://localhost:9000/store/blog/category/first-category/posts",
"path": [
"store",
"blog",
"category-posts",
"first-category"
"category",
"first-category",
"posts"
],
"protocol": "http",
"host": [