| Total Complexity | 6 | 
| Complexity/F | 1.5 | 
| Lines of Code | 30 | 
| Function Count | 4 | 
| Duplicated Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
| 1 | import path from 'path'  | 
            ||
| 2 | import { | 
            ||
| 3 | cmsOperations,  | 
            ||
| 4 | abeExtend,  | 
            ||
| 5 | Manager  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 6 | } from '../../cli'  | 
            ||
| 7 | |||
| 8 | var route = function(req, res, next){ | 
            ||
| 9 |   abeExtend.hooks.instance.trigger('beforeRoute', req, res, next) | 
            ||
| 10 | if(typeof res._header !== 'undefined' && res._header !== null) return  | 
            ||
| 11 | |||
| 12 | var p = cmsOperations.post.publish(  | 
            ||
| 13 | req.body.filePath,  | 
            ||
| 14 | req.body.tplPath,  | 
            ||
| 15 | req.body.json  | 
            ||
| 16 | );  | 
            ||
| 17 | |||
| 18 |   p.then((result) => { | 
            ||
| 19 |     res.set('Content-Type', 'application/json') | 
            ||
| 20 | res.send(JSON.stringify(result))  | 
            ||
| 21 | },  | 
            ||
| 22 |   (result) => { | 
            ||
| 23 |     res.set('Content-Type', 'application/json') | 
            ||
| 24 | res.send(JSON.stringify(result))  | 
            ||
| 25 |   }).catch(function(e) { | 
            ||
| 26 |     console.error('[ERROR] post-publish.js', e) | 
            ||
| 27 | })  | 
            ||
| 28 | }  | 
            ||
| 29 | |||
| 30 | export default route  |