Supertest Prefix
An extension to supertest which adds a prefix to the routes
Usage
;; // Creates the prefixconst prefix = ; // Uses the prefixawait request // Becomes /api/cars ; await request // Becomes http://localhost:3000/api/cars ;
Using with npm 'superagent-defaults'
https://www.npmjs.com/package/superagent-defaults
;;; // Creates the prefixconst prefix = ; // Create a defaults contextvar request = ; // Setup prefix as a default configrequest ; // Use supertest like you always have; the prefix will be applied to each request automaticallyawait request ;
Contributors
Would you like to contribute to this library? Don't be shy! Contact me if you are interested on it.