generated from azures04/Base-REST-API
MVP
This commit is contained in:
12
routes/products/[productName]/[productPlatform]/download.js
Normal file
12
routes/products/[productName]/[productPlatform]/download.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const express = require("express")
|
||||
const productsFileService = require("../../../../services/productsFileService")
|
||||
const router = express.Router({ mergeParams: true })
|
||||
|
||||
router.get(/.*/, async (req, res, next) => {
|
||||
const { productName, productPlatform } = req.params
|
||||
await productsFileService.canAccess(productName, productPlatform)
|
||||
const file = await productsFileService.getFile(req.url, productName, productPlatform)
|
||||
return res.status(200).download(file.path)
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
12
routes/products/[productName]/[productPlatform]/manifest.js
Normal file
12
routes/products/[productName]/[productPlatform]/manifest.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const express = require("express")
|
||||
const productsFileService = require("../../../../services/productsFileService")
|
||||
const router = express.Router({ mergeParams: true })
|
||||
|
||||
router.get("/", async (req, res) => {
|
||||
const { productName, productPlatform } = req.params
|
||||
await productsFileService.canAccess(productName, productPlatform)
|
||||
const files = await productsFileService.getProductFiles(productName, productPlatform)
|
||||
return res.status(200).json(files)
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
Reference in New Issue
Block a user