Tell us what’s happening:
Even though my server is responsing with the same json response as fcc examplary filemetadata project but still someohow last test fails.
###Your project link(s)
server.js code
var express = require(‘express’);
var cors = require(‘cors’);
require(‘dotenv’).config();
const multer = require(‘multer’);
var app = express();
const upload = multer({ dest:‘./public/data/uploads/’});
app.use(cors());
app.use(‘/public’, express.static(process.cwd() + ‘/public’));
app.get(‘/’, function (req, res) {
res.sendFile(process.cwd() + ‘/views/index.html’);
});
app.post(‘/api/fileanalyse’, upload.single(‘upfile’), (req, res) => {
if (!req.file) {
return res.status(400).json({ error: 'No file uploaded' });
}
res.json({
name: req.file.originalname,
type: req.file.mimetype,
size: req.file.size
});
});
const port = process.env.PORT || 3000;
app.listen(port, function () {
console.log('Your app is listening on port ’ + port);
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Challenge Information:
Back End Development and APIs Projects - File Metadata Microservice