Impl: project requirements
This commit is contained in:
parent
aa91c119d8
commit
dc32554e22
10
index.js
10
index.js
@ -1,5 +1,7 @@
|
|||||||
const express = require("express");
|
const express = require("express");
|
||||||
const cors = require("cors");
|
const cors = require("cors");
|
||||||
|
const multer = require("multer");
|
||||||
|
const upload = multer({ storage: multer.memoryStorage() });
|
||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
|
|
||||||
const PORT = process.env.PORT || 57268;
|
const PORT = process.env.PORT || 57268;
|
||||||
@ -13,8 +15,12 @@ app.get("/", function (req, res) {
|
|||||||
res.sendFile(process.cwd() + "/views/index.html");
|
res.sendFile(process.cwd() + "/views/index.html");
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/api/fileanalyse", (req, res) => {
|
app.post("/api/fileanalyse", upload.single("upfile"), (req, res) => {
|
||||||
res.json({ Hello: ", World!" });
|
res.json({
|
||||||
|
name: req.file?.originalname,
|
||||||
|
type: req.file?.mimetype,
|
||||||
|
size: req.file?.size,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(PORT, function () {
|
app.listen(PORT, function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user