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 cors = require("cors");
|
||||
const multer = require("multer");
|
||||
const upload = multer({ storage: multer.memoryStorage() });
|
||||
require("dotenv").config();
|
||||
|
||||
const PORT = process.env.PORT || 57268;
|
||||
@ -13,8 +15,12 @@ app.get("/", function (req, res) {
|
||||
res.sendFile(process.cwd() + "/views/index.html");
|
||||
});
|
||||
|
||||
app.post("/api/fileanalyse", (req, res) => {
|
||||
res.json({ Hello: ", World!" });
|
||||
app.post("/api/fileanalyse", upload.single("upfile"), (req, res) => {
|
||||
res.json({
|
||||
name: req.file?.originalname,
|
||||
type: req.file?.mimetype,
|
||||
size: req.file?.size,
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(PORT, function () {
|
||||
|
Loading…
Reference in New Issue
Block a user