chore(bump): updated versions (#1177)
* feat(upgrade): updated up to angular 11 tests are failed * chore(bump): updated versions * chore(bump): updated package * fix(style): delete extra rule * disabled ivy build, added prod config, changed demo serve script * feat(bump): added strict mode, doesn't build in dist, should be resolved * feat(core): added nx * feat(core): updated dependencies list * feat(github actions): check gh actions * feat(gh actions): try gh actions * feat(gh actions): try gh actions * feat(gh actions): try gh actions * feat(gh actions): try gh actions * feat(gh actions): try gh actions * feat(github actions): delete codecov * feat(firebase): try firebase actions * feat(firebase): try firebase actions * feat(firebase): try firebase actions * feat(firebase): try firebase actions * feat(firebase): try firebase actions * feat(strict): added strict mode * feat(github actions): updated yml file * fix(lint): fixed linting errors * fix(lint): fixed linting errors * fix(lint): fixed lint errors * Delete hosting.ZGlzdC9hcHBzL2RlbW8.cache * feat(github actions): added publish action * fix(firebase): test extra folder https Co-authored-by: Mishchenko Dmitriy <ripatrip@gmail.com> Co-authored-by: Dmitriy Shekhovtsov <valorkin@gmail.com>
This commit was merged in pull request #1177.
This commit is contained in:
committed by
GitHub
parent
8171bc831b
commit
be27edbe13
50
apps/demo/server/file-catcher.js
Normal file
50
apps/demo/server/file-catcher.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/*eslint-disable*/
|
||||
var express = require('express');
|
||||
var multer = require('multer');
|
||||
var fs = require('fs');
|
||||
var app = express();
|
||||
|
||||
var DIR = './uploads/';
|
||||
|
||||
var upload = multer({dest: DIR});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
res.setHeader('Access-Control-Allow-Origin', 'http://valor-software.github.io');
|
||||
res.setHeader('Access-Control-Allow-Methods', 'POST');
|
||||
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
|
||||
res.setHeader('Access-Control-Allow-Credentials', true);
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(multer({
|
||||
dest: DIR,
|
||||
rename: function (fieldname, filename) {
|
||||
return filename + Date.now();
|
||||
},
|
||||
onFileUploadStart: function (file) {
|
||||
console.log(file.originalname + ' is starting ...');
|
||||
},
|
||||
onFileUploadComplete: function (file) {
|
||||
console.log(file.fieldname + ' uploaded to ' + file.path);
|
||||
}
|
||||
}));
|
||||
|
||||
app.get('/api', function (req, res) {
|
||||
res.end('file catcher example');
|
||||
});
|
||||
|
||||
app.post('/api', function (req, res) {
|
||||
upload(req, res, function (err) {
|
||||
if (err) {
|
||||
return res.end(err.toString());
|
||||
}
|
||||
|
||||
res.end('File is uploaded');
|
||||
});
|
||||
});
|
||||
|
||||
var PORT = process.env.PORT || 3000;
|
||||
|
||||
app.listen(PORT, function () {
|
||||
console.log('Working on port ' + PORT);
|
||||
});
|
||||
Reference in New Issue
Block a user