May I know how express’s post request takes parameters?

  node.js, question

As a beginner of Node.js, refer to “Node.js actual combat” and make a website for uploading pictures. The tutorial is relatively long, and in some places I changed the way I used it in the latest version of express. For example:
Originally his route is like this:
app.js

App.set ('photos',' _ _ dirname plus' /public/photos');
 ....
 app.get('/', photos.list);
 app.get('/upload', photos.form);
 app.post('/upload', photos.submit(app.get('photos')));

routes/photo.js

exports.form = function(req, res){
 res.render('photos/upload', {
 title: 'Photo upload'
 });
 };
 
 exports.submit = function (dir) {
 return function(req, res, next){
 var img = req.files.photo.image;
 var name = req.body.photo.name || img.name;
 var path = join(dir, img.name);
 
 fs.rename(img.path, path, function(err){
 if (err) return next(err);
 
 Photo.create({
 name: name,
 path: img.name
 }, function(err) {
 if (err) return next(err);
 res.redirect('/');
 });
 });
 };
 };

Then I changed it like this
app.js

App.set ('photos',' _ _ dirname plus' /public/photos');
 ....
 app.use('/', photos);
 app.use('/upload',photos)
 App.post('/upload',photos)// problem does not know how to pass parameters here

routes/photo.js

var express = require('express');
 var router = express.Router();
 ......
 router.get('/', function(req, res, next) {
 res.render('photos',{
 title:'photos',
 photos: photos
 });
 });
 
 router.get('/upload',function(req, res, next){
 res.render('photos/upload', {
 title: 'Photo upload'
 });
 })
 router.post('/upload',function(dir){
 console.log(dir)
 return function(req,res,next){
 var img = req.files.photo.image;
 var name = req.body.photo.name || img.name;
 var path = join(dir, img.name);
 console.log(1)
 fs.rename(img.path, path, function(err){
 if (err) return next(err);
 console.log(2)
 
 Photo.create({
 name: name,
 path: img.name
 }, function(err) {
 if (err) return next(err);
 res.redirect('/');
 });
 });
 bracket
 })
 .......
 module.exports=router;

Although I don’t know the difference between the two exports = =, but the content I generated according to the framework is modeled and changed, however, the dir parameter in post mode doesn’t know how to pass it on to app.js

app.post('/upload',photos)

App needs to use the router you export.
For example, in the app.js file:

var photoRouter = require('photo');  //Suppose two are in the same path
 ...
 
 app.use(photoRouter);
 
 ...