diff options
author | Kyle K <kylek389@gmail.com> | 2017-03-19 02:20:34 -0500 |
---|---|---|
committer | Kyle K <kylek389@gmail.com> | 2017-03-19 02:20:34 -0500 |
commit | f16ed31e84dc8fda7f217be12dd715690b54f471 (patch) | |
tree | c483f4eaeced3ef5bcdedb2e6549348e2c6cf99b | |
parent | 00df5136aaf9a2aee9b9b5121f73dee7f3810d29 (diff) | |
download | express-upload-f16ed31e84dc8fda7f217be12dd715690b54f471.tar.gz express-upload-f16ed31e84dc8fda7f217be12dd715690b54f471.tar.bz2 express-upload-f16ed31e84dc8fda7f217be12dd715690b54f471.zip |
- add gulpfile and bower preparing for use with vue.js and jquery
- use express 4.x
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | app.js (renamed from server.js) | 20 | ||||
-rw-r--r-- | bower.json | 20 | ||||
-rw-r--r-- | gulpfile.js | 18 | ||||
-rw-r--r-- | package.json | 26 |
5 files changed, 66 insertions, 22 deletions
@@ -13,3 +13,7 @@ node_modules/ # AWS # ####### .elasticbeanstalk/ + +# bower # +######## +bower_components/ @@ -16,15 +16,15 @@ function fnAppend(fn, insert) { return arr + '.' + insert + '.' + ext; } -app.configure(function () { - app.use(multer({ - dest: './static/uploads/', - rename: function (fieldname, filename) { - return filename.replace(/\W+/g, '-').toLowerCase(); - } - })); - app.use(express.static(__dirname + '/static')); -}); + +app.use(multer({ + dest: './static/uploads/', + rename: function (fieldname, filename) { + return filename.replace(/\W+/g, '-').toLowerCase(); + } +})); +app.use(express.static(__dirname + '/static')); + app.post('/api/upload', function (req, res) { res.send({image: false, file: req.files.userFile.originalname, savedAs: req.files.userFile.name}); @@ -37,4 +37,4 @@ app.get('/api/filenames', function (req, res) { // this is the RESTful API that var server = app.listen(8081, function () { console.log('listening on port %d', server.address().port); -});
\ No newline at end of file +}); diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..fdeb4cf --- /dev/null +++ b/bower.json @@ -0,0 +1,20 @@ +{ + "name": "express-upload", + "description": "nodejs-express-uploader: node.js, express, multer, html5 progress file upload app", + "main": "", + "authors": [ + "Kyle K <kylek389@gmail.com>" + ], + "license": "MIT", + "homepage": "https://github.com/fatalhalt/express-upload", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "jquery": "^3.2.0" + } +} diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..819ef94 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,18 @@ +var gulp = require('gulp'); +var paths = { + bower: './bower_components', + npm: './node_modules', + frontend: './static' +}; + +gulp.task('copy', function () { + return gulp.src(paths.bower + '/jquery/dist/jquery.min.js') + .pipe(gulp.dest(paths.frontend + '/js')); +}); +gulp.task('copy2', function () { + return gulp.src(paths.npm + '/vue/dist/vue.min.js') + .pipe(gulp.dest(paths.frontend + '/js')); +}); + +gulp.task('default', ['copy','copy2']); + diff --git a/package.json b/package.json index 6c67f56..2e1a1cb 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,15 @@ { - "name": "nodejs express file uploader", - "description": "nodejs-express-uploader: node.js, express, multer, html5 progress file upload app", - "version": "0.0.1", - "engines": { - "node": ">= 0.10.x" - }, - "private": true, - "dependencies": { - "express": "3.x", - "multer": "0.x" - } -}
\ No newline at end of file + "name": "express-upload", + "description": "nodejs-express-uploader: node.js, express, multer, html5 progress file upload app", + "version": "0.0.1", + "engines": { + "node": ">= 0.10.x" + }, + "private": true, + "dependencies": { + "express": "^4.15.2", + "gulp": "^3.9.1", + "multer": "0.x", + "vue": "^2.2.4" + } +} |