the-fake-backend
the-fake-backend copied to clipboard
Method file should have its endpoint path as folder prefix
As in file inferring when neither file or data attributes are present, it would be nice to have the endpoint path as folder prefix when a file is given, so it wouldn't allow the data folder to be unorganized.
Example:
{
path: '/menu/categories',
methods: [
{
type: 'get',
overrides: [
{
name: 'Default',
},
{
name: 'Duplicated',
file: 'duplicated.json',
// would infer the file 'data/menu/categories/duplicated.json', or maybe 'data/menu/categories-duplicated.json'
},
],
},
{
type: 'post',
file: 'created.json',
// would infer the file 'data/menu/categories/created.json', or maybe 'data/menu/categories-created.json'
},
],
},
Another interesting addition would to have the HTTP method in the inferred file, e.g.:
{
path: '/menu/categories',
methods: [
{
type: 'post',
// would infer the file 'data/menu/categories/post.json'
},
],
},
To accomplish it, we could just join the inferred path with the given file attribute, it would easy IMHO :)