edit build
This commit is contained in:
parent
c60ec07923
commit
e921875bde
2 changed files with 1 additions and 7 deletions
|
|
@ -17,6 +17,6 @@ COPY templates templates
|
||||||
COPY package.json .
|
COPY package.json .
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY dist2 .
|
COPY dist .
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
CMD ["node","app.js"]
|
CMD ["node","app.js"]
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,6 @@ docxTemplateRoute.post("/", async function (req, res) {
|
||||||
if (!req.headers["content-type"] || !req.headers["accept"]) throw new Error("Require header content-type, accept")
|
if (!req.headers["content-type"] || !req.headers["accept"]) throw new Error("Require header content-type, accept")
|
||||||
let inputType = mimeToExtension(req.headers["content-type"])
|
let inputType = mimeToExtension(req.headers["content-type"])
|
||||||
let outputMediaType = mimeToExtension(req.headers["accept"])
|
let outputMediaType = mimeToExtension(req.headers["accept"])
|
||||||
console.log("content-type: ", inputType)
|
|
||||||
console.log("accept: ", outputMediaType)
|
|
||||||
let template = null
|
let template = null
|
||||||
// Save the converted file to disk
|
// Save the converted file to disk
|
||||||
if (req.query["folder"]) {
|
if (req.query["folder"]) {
|
||||||
|
|
@ -224,13 +222,11 @@ docxTemplateRoute.post("/upload", async function (req, res) {
|
||||||
res.statusCode = 400
|
res.statusCode = 400
|
||||||
res.statusMessage = "Require header: content-type(application/octet-stream) accept"
|
res.statusMessage = "Require header: content-type(application/octet-stream) accept"
|
||||||
res.end(res.statusMessage)
|
res.end(res.statusMessage)
|
||||||
console.log(req.headers["content-type"], req.headers["accept"], req.query["report_name"])
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Determine the output media type and report name from headers
|
// Determine the output media type and report name from headers
|
||||||
let outputMediaType = mimeToExtension(req.headers["accept"])
|
let outputMediaType = mimeToExtension(req.headers["accept"])
|
||||||
let reportName = req.query["report_name"]
|
let reportName = req.query["report_name"]
|
||||||
console.log("convert output: " + outputMediaType)
|
|
||||||
|
|
||||||
// Save the converted file to disk
|
// Save the converted file to disk
|
||||||
if (req.query["folder"]) {
|
if (req.query["folder"]) {
|
||||||
|
|
@ -297,8 +293,6 @@ docxTemplateRoute.post("/download", async function (req, res) {
|
||||||
if (!req.headers["content-type"] || !req.headers["accept"] || !req.body.template) throw new Error("Require header content-type, accept")
|
if (!req.headers["content-type"] || !req.headers["accept"] || !req.body.template) throw new Error("Require header content-type, accept")
|
||||||
let inputType = mimeToExtension(req.headers["content-type"])
|
let inputType = mimeToExtension(req.headers["content-type"])
|
||||||
let outputMediaType = mimeToExtension(req.headers["accept"])
|
let outputMediaType = mimeToExtension(req.headers["accept"])
|
||||||
console.log("content-type: ", inputType)
|
|
||||||
console.log("accept: ", outputMediaType)
|
|
||||||
let buffer = null
|
let buffer = null
|
||||||
if (req.query["folder"]) {
|
if (req.query["folder"]) {
|
||||||
buffer = await fs.promises.readFile(`./${TEMPLATE_FOLDER_NAME}/${req.query["folder"]}/${req.body.template}.docx`)
|
buffer = await fs.promises.readFile(`./${TEMPLATE_FOLDER_NAME}/${req.query["folder"]}/${req.body.template}.docx`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue