Overtorment / Cashier-BTC

💰 Self-hosted Bitcoin payment gateway (฿)
286 stars 101 forks source link

Better routes #8

Open Kotevode opened 6 years ago

Kotevode commented 6 years ago

I don't really think that your routes are comfortable to use, for example:

GET /request_payment/:expect/:currency/:message/:seller/:customer/:callback_url

When you build a wrapper, joining these parameters is very tricky process: you should always match values with position. Maybe they should be passed via query string?

Overtorment commented 6 years ago

@Kotevode thanks for a suggestion! Perfectly valid point, but this is the default routing mechanism in Expressjs framework here. If you can, please suggest an alternative.

acalatrava commented 6 years ago

AFAIK you can also use query string like this:

router.get('/request_payment', function(req, res) {
    var expect = req.query.expect;
    var currency = req.query.currency;
    var message = req.query.messge;
    ...
});

This should match a query like this:

GET /request_payment?currency=USD&message=This%20is%20your%20purchase&expect=100000