File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 33const exportMarkdown = require ( './exportMarkdown' ) ;
44
55exports . expressCreateServer = ( hookName , { app} ) => {
6- app . get ( '/p/:padId/:revNum?/export/markdown' , ( req , res , next ) => {
7- ( async ( ) => {
6+ app . get ( '/p/:padId/export/markdown' , async ( req : any , res : any , next : any ) => {
7+ try {
8+ const { padId} = req . params ;
9+ res . attachment ( `${ padId } .md` ) ;
10+ res . contentType ( 'plain/text' ) ;
11+ res . send ( await exportMarkdown . getPadMarkdownDocument ( padId ) ) ;
12+ } catch ( err ) {
13+ next ( err || new Error ( err ) ) ;
14+ }
15+ } ) ;
16+
17+ app . get ( '/p/:padId/:revNum/export/markdown' , async ( req : any , res : any , next : any ) => {
18+ try {
819 const { padId, revNum} = req . params ;
920 res . attachment ( `${ padId } .md` ) ;
1021 res . contentType ( 'plain/text' ) ;
1122 res . send ( await exportMarkdown . getPadMarkdownDocument ( padId , revNum ) ) ;
12- } ) ( ) . catch ( ( err ) => next ( err || new Error ( err ) ) ) ;
23+ } catch ( err ) {
24+ next ( err || new Error ( err ) ) ;
25+ }
1326 } ) ;
1427} ;
You can’t perform that action at this time.
0 commit comments