Getting started¶
Installation¶
As a local npm dependency in your node project¶
-
Simply install it as a dev dependency of the project you want to mock.
-
Define a script in your
package.jsonfile for simpler usage
Note
Drosse also ships with an esm compatible version (as of version 3.1.0) which
you should launch with drosse-esm:
As a global npm package¶
-
Install drosse globally.
-
Run it via the
servecommand followed by the path of your drosse root folder:
Usage¶
You need a directory where you will store all your mocks definitions.
- Create a directory anywhere in your project repository (or anywhere else).
- Update the
package.jsonscript you just added in the Installation phase to target your new mocks directory. - In your mocks directory, create a
routes.jsonfile. This file will hold every single mocked route of your server. - In the same directory, you can also create a
.drosserc.jsfile. This file allows you to configure your mock server (see Configuration). It's optional but you will very likely need it.