Accept a single file with the name fieldname. The single file will be stored in req.file.
single file with the name fieldname
input(type="file" name="img" required)
single('filedata')
name="img"
If your class doesn't extend another provider, you should always prefer using constructor-based injection.
proxy_pass http://127.0.0.1:3000/;
нужен чтоб убрать /back/server {
listen 80;
server_name site.localhost;
location /back/ {
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_pass http://127.0.0.1:3000/;
}
}
const express = require('express');
const app = express();
const cors = require('cors');
app.use(cors());
app.post('/', (req, res) => {
res.json({ 1: 1 });
});
app.listen(3000);
(async () => {
const res = await fetch('http://site.localhost/back/', { method: 'POST' }).then(r => r.json())
console.log(res)
})();
Есть дев сервер, который поднимает Vue-cli, соответственно vue-cli вешает его на
localhost:8000
, или что там? не помнюесть сервер, который поднимаю я через nodeJS
Когда клиент подключается к серверу node, то я отправляю ему файл index.html из /public
function queryString(params) {
return Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join('&');
}
const fs = require('fs');
const http = require('https');
var download = function(url, dest, cb) {
var file = fs.createWriteStream(dest);
var request = http.get(url, function(response) {
response.pipe(file);
file.on('finish', function() {
file.close(cb);
});
});
};
download('https://rossvyaz.ru/data/DEF-9xx.csv', './def.csv', '');