fauxrest provides a small command surface for build and local verification workflows.
How to run fauxrest
#
A CLI tool for generating static JSON APIs from local data files
Usage: fauxrest [OPTIONS] <DATA_DIR>
Arguments:
<DATA_DIR> Path to the input data directory
Options:
-L, --level <LEVEL> Specify the log level [default: warn] [possible values: error, warn, info, debug, trace]
-c, --config <CONFIG_FILE> Path to the configuration file
-l, --layout <LAYOUT> Layout to use for the output [possible values: index, file, extension]
-d, --dest <DEST_DIR> Path to the output directory [default: dist]
-s, --serializer <SERIALIZER> Serializer to use for the output. [available: json, typescript, sql] [default: json]
--minify If true, minify the output
-h, --help Print help (see more with '--help')
-V, --version Print versionBuild psuede REST data #
Compile datasets into static outputs.
fauxrest data_dirTypical behavior:
- Reads data from
./data_dir(The json files starts with_and.are ignored). - Loads configuration from
data_dirfolder (finds_config.json,_fauxrest.json,.config_json, and.fauxrest.jsonin this order). - Runs configured serializers and layouts.
- Writes artifacts to serializer-specific destinations.
Note that if no dest directory is specified,
fauxrest will write to the dist directory by default with the index layout.
Also, config files can be located in data_dir and can specify the output directory, layout, and serializer.
Typical Local Loop #
- Edit JSON data or config.
- Run
fauxrestfor deterministic artifact generation.
🐳 Container image support #
docker run -it --rm -v $PWD:/opt quay.io/tama5/fauxrest:latest