Skip to content
Myr

app.js

This file

Path

examples/upload/app.js

45 lines · 828 bytes · JavaScript

Last changed by

Merge branch 'node-0.1.30'visionmediabefore adoptionf7d7c4a

History of this file

Take it

Merge branch 'master' of git://github.com/visionmedia/expressciaranjbefore adoption046bee8

lines 1–9why, one step back
1
2require.paths.unshift('lib')3require('express')4require('express/plugins')56configure(function(){7 use(MethodOverride)8 use(ContentLength)9 use(CommonLogger)

Merge branch 'flash'visionmediabefore adoptione351a02

lines 10–12why, one step back
10 use(Cookie)
11 use(Session)12 use(Flash)

Mergevisionmediabefore adoptioncec6770

line 13why, one step back
13 set('root', __dirname)

Merge branch 'master' of git://github.com/visionmedia/expressciaranjbefore adoption046bee8

lines 14–20why, one step back
14})
1516get('/', function(){17 this.redirect('/upload')18})1920get('/upload', function(){

Merge branch 'flash'visionmediabefore adoptione351a02

lines 21–25why, one step back
21 this.render('upload.haml.html', {
22 locals: {23 flashes: this.flash('info')24 } 25 })

Merge branch 'master' of git://github.com/visionmedia/expressciaranjbefore adoption046bee8

lines 26–27why, one step back
26})
27

Merge branch 'node-0.1.30'visionmediabefore adoptionf7d7c4a

lines 28–29why, one step back
28post('/upload', function(){
29 var self = this;

Sample upload app outputvisionmediabefore adoption1726dfb

line 30why, one step back
30 $(this.param('images')).each(function(image){

Merge branch 'flash'visionmediabefore adoptione351a02

lines 31–32why, one step back
31 puts(image.filename + ' -> ' + image.tempfile)
32 self.flash('info', 'Uploaded ' + image.filename)

Merge branch 'node-0.1.30'visionmediabefore adoptionf7d7c4a

line 33why, one step back
33 })

Merge branch 'master' of git://github.com/visionmedia/expressciaranjbefore adoption046bee8

lines 34–37why, one step back
34 this.redirect('/upload')
35})3637get('/public/*', function(file){

Mergevisionmediabefore adoptioncec6770

line 38why, one step back
38 this.sendfile(__dirname + '/public/' + file)

Merge branch 'master' of git://github.com/visionmedia/expressciaranjbefore adoption046bee8

lines 39–45why, one step back
39})
4041get('/*.css', function(file){42 this.render(file + '.sass.css', { layout: false })43})4445run()