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