restify-router icon indicating copy to clipboard operation
restify-router copied to clipboard

Upload file with multer

Open cbcarlos07 opened this issue 4 years ago • 3 comments

When I use with only restify I use:

server.post('/upload', uploads.single('foto'), async (req, res, next)=>{
    
      try {
          res.send( saveObj  )
      } catch (error) {
          res.send(error)
      }
      next()
  })

But if I use with restify-router, I get this wrong

Argument of type 'RequestHandler<ParamsDictionary>' is not assignable to parameter of type 'RequestHandlerType'. Type 'RequestHandler<ParamsDictionary>' is not assignable to type 'RequestHandler'. Types of parameters 'req' and 'req' are incompatible. Type 'Request' is missing the following properties from type 'Request<ParamsDictionary, any, any>': get, acceptsCharsets, acceptsEncodings, acceptsLanguages, and 20 more.ts(2345)

issue

Is possible to do upload with restify-router?

cbcarlos07 avatar Mar 11 '20 13:03 cbcarlos07

@cbcarlos07 could you test this with the latest version? @otaviotech added some declarations to support this.

ukayani avatar Jul 21 '20 20:07 ukayani

@cbcarlos07 could you test this with the latest version? @otaviotech added some declarations to support this.

Of Multer or restify-router?

cbcarlos07 avatar Jul 22 '20 11:07 cbcarlos07

of restify-router

ukayani avatar Jul 22 '20 15:07 ukayani