skewten-incubator / pcb

Middleware-based API framework - It's Koa, but for APIs.
0 stars 0 forks source link

Routing: params -> argument list #9

Open SEAPUNK opened 8 years ago

SEAPUNK commented 8 years ago

I'm going to apply a pattern to how path parameters are managed.

Say we have a path: /rack/:rack_id/change_barcode/:new_barcode And let's say we have a function for it: changeRackBarcode()

What we'll do here is the following:

changeRackBarcode(rack_id, new_barcode, data, ctx)

It makes sense, and is definitely a good pattern to follow.