In express I have a route that doesn't match and I want to know why? -


when send:

patch /55148df6935c4bac084b30b2/token/eyj0exaioijkv1qilcjhbgcioijiuzi1nij9.eyjfawqioii1nte0ogrmnjkznwm0ymfjmdg0yjmwyjiilcjpyxqioje0mzaynte2otg5ndisimv4cci6mtqzmdi1mtkzodk0mn0.n8itqpaf7hjyq23ke977s0oamqxswef9ifr62mlo9sw 

i 404? why? missing?

the route

router.patch('/:id/token/(.+)/', ...) 

clearly missing assumption. string long? '.' in string causing issues? can help?

express doesn't accept raw regex patterns in path this. need attach them named route parameter. specify regex this: :token([\\w\.]+), default :token should match test string. example, you're looking for:

router.patch('/:id/token/:token', function(req, res) {     console.log('my id:', req.params.id);     console.log('my token:', req.params.token); }) 

but suggest sending patch data in body of request , not in request path. can send them url encoded form parameters (eg token=1234abcd) or json example. more "canonical" , other advantage don't have potentially sensitive information getting saved in browser history , http logs.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -