88* */
99var express = require ( 'express' ) ,
1010 http = require ( 'http' ) ,
11- //upload = require('../index');
12- upload = require ( 'jquery-file-upload-middleware' ) ; // don't work 0.0.8 && update > 0.0.8
11+ upload = require ( '../' ) ;
1312
14- var cons = require ( 'consolidate' ) ,
15- swig = require ( 'swig' ) ;
13+ var swig = require ( 'swig' ) ;
1614
1715
1816// configuration
@@ -26,15 +24,12 @@ var app = express();
2624
2725
2826// set template engine
29- app . engine ( 'html' , cons . swig ) ;
30- swig . init ( {
31- root : __dirname + '/views' ,
32- allowErrors : true ,
33- cache : false
27+ app . engine ( 'html' , swig . renderFile ) ;
28+ swig . setDefaults ( {
29+ cache : false // default 'memory'
3430} ) ;
3531
3632
37-
3833// jquery-file-upload helper
3934app . use ( '/upload/default' , function ( req , res , next ) {
4035 upload . fileHandler ( {
@@ -74,6 +69,7 @@ upload.on('end', function (fileInfo) {
7469
7570upload . on ( 'delete' , function ( fileName ) {
7671 // remove file info
72+ console . log ( "files remove complete" ) ;
7773 console . log ( fileName ) ;
7874} ) ;
7975
@@ -114,7 +110,11 @@ app.configure('production', function () {
114110* routes
115111* */
116112app . get ( '/' , function ( req , res ) {
117- res . send ( 'Call this url in browser : http://localhost:3001/location/input' ) ;
113+ var html = [
114+ '<p>Call this url in browser : http://localhost:3001/location/input <a href="/location/input">Go</a></p>' ,
115+ '<p>Call this url in browser : http://localhost:3001/upload/location/list <a href="/upload/location/list">Go</a></p>'
116+ ] . join ( '' ) ;
117+ res . send ( html ) ;
118118} ) ;
119119
120120
@@ -140,4 +140,5 @@ app.post('/location/input', function (req, res) {
140140http . createServer ( app ) . listen ( app . get ( 'port' ) , function ( ) {
141141 console . log ( "Express server listening on port " + app . get ( 'port' ) ) ;
142142 console . log ( "access url /location/input" ) ;
143+ console . log ( "access url /upload/location/list" ) ;
143144} ) ;
0 commit comments