javascript - Express Router - reference function -


i trying reference function route in code below (attempt 1 & 2). route not being found. seems express not able pick reference functions.

can tell me doing wrong?

/* routes/profile.js */ import { router } 'express'; const profilerouter = new router();  profilerouter.get('/', getallprofiles); profilerouter.get('/:id', getprofilebyid);  /* attempt 1 - route not found */ function getallprofiles(req, res, next) { };  /* attempt 2 - route not found */ const getprofilebyid = (req, res, next) => { };  /* normal way - works */ profilerouter.delete('/:id', (req, res, next) => { /*delete profile */ });  /* completion: if route not found */ router.use( (req, res) => { return res.status(404).send('not found!' });  export default profilerouter; 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -