generated from azures04/Base-REST-API
Compare commits
2 Commits
1ddcf1eaf2
...
7e9496b35d
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e9496b35d | |||
| 5eaca1e948 |
@ -3,8 +3,12 @@ const metaService = require("../services/metaService")
|
||||
const router = express.Router({ mergeParams: true })
|
||||
|
||||
router.get(/.*/, async (req, res, next) => {
|
||||
const file = metaService.serveStaticFile(req.originalUrl)
|
||||
return res.status(200).sendFile(file)
|
||||
try {
|
||||
const file = metaService.serveStaticFile(req.originalUrl)
|
||||
return res.status(200).sendFile(file)
|
||||
} catch (error) {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
@ -1,11 +1,11 @@
|
||||
const express = require("express")
|
||||
const productsFileService = require("../../../../services/productsFileService")
|
||||
const productsService = require("../../../../services/productsService")
|
||||
const router = express.Router({ mergeParams: true })
|
||||
|
||||
router.get(/.*/, async (req, res, next) => {
|
||||
const { productName, productPlatform } = req.params
|
||||
await productsFileService.canAccess(productName)
|
||||
const file = await productsFileService.getFile(req.url, productName, productPlatform)
|
||||
await productsService.canAccess(productName)
|
||||
const file = await productsService.getFile(req.url, productName, productPlatform)
|
||||
return res.status(200).download(file.path)
|
||||
})
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
const express = require("express")
|
||||
const productsFileService = require("../../../../services/productsFileService")
|
||||
const productsService = require("../../../../services/productsService")
|
||||
const router = express.Router({ mergeParams: true })
|
||||
|
||||
router.get("/", async (req, res) => {
|
||||
const { productName, productPlatform } = req.params
|
||||
await productsFileService.canAccess(productName)
|
||||
const files = await productsFileService.getProductFiles(productName, productPlatform)
|
||||
await productsService.canAccess(productName)
|
||||
const files = await productsService.getProductFiles(productName, productPlatform)
|
||||
return res.status(200).json(files)
|
||||
})
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
const express = require("express")
|
||||
const productsFileService = require("../../../../services/productsFileService")
|
||||
const productsService = require("../../../../services/productsService")
|
||||
const router = express.Router({ mergeParams: true })
|
||||
|
||||
router.get("/", async (req, res) => {
|
||||
const { productName, productPlatform } = req.params
|
||||
await productsFileService.canAccess(productName)
|
||||
const files = await productsFileService.getRequirementsForPlatform(productName, productPlatform)
|
||||
await productsService.canAccess(productName)
|
||||
const files = await productsService.getRequirementsForPlatform(productName, productPlatform)
|
||||
return res.status(200).json(files)
|
||||
})
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
const express = require("express")
|
||||
const productsFileService = require("../../../services/productsFileService")
|
||||
const productsService = require("../../../services/productsService")
|
||||
const router = express.Router({ mergeParams: true })
|
||||
|
||||
router.get("/", async (req, res) => {
|
||||
const { productName } = req.params
|
||||
await productsFileService.canAccess(productName)
|
||||
const files = await productsFileService.getInstallerResources(productName)
|
||||
await productsService.canAccess(productName)
|
||||
const files = await productsService.getInstallerResources(productName)
|
||||
return res.status(200).json(files)
|
||||
})
|
||||
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
const express = require("express")
|
||||
const router = express.Router({ mergeParams: false })
|
||||
const productsFileService = require("../../services/productsFileService")
|
||||
const productsService = require("../../services/productsService")
|
||||
|
||||
router.get("/", async (req, res) => {
|
||||
const products = await productsFileService.getProducts()
|
||||
const products = await productsService.getProducts()
|
||||
return res.status(200).json(products)
|
||||
})
|
||||
|
||||
router.get("/product/:productName", async (req, res) => {
|
||||
const product = await productsFileService.getProduct(req.params.productName)
|
||||
const product = await productsService.getProduct(req.params.productName)
|
||||
return res.status(200).json(product)
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user