vovk.config.js
The config file allows to change default options in order to customise generated client or its path. The default config looks like that:
/vovk.config.js
/** @type {import('vovk').VovkConfig} */
const vovkConfig = {
clientOut: './node_modules/.vovk',
route: './src/app/api/[[...vovk]]/route.ts',
modulesDir: './src/modules',
fetcher: 'vovk/client/defaultFetcher',
prefix: '/api',
validateOnClient: '',
};
module.exports = vovkConfig;
clientOut
- where the client is going to be compiled to. Can be overriden byVOVK_CLIENT_OUT
env variable.route
- allows to redefine path to the wildcard route (the slug can be any non-empty string, it's name is not utilised by Vovk.ts). Can be overriden byVOVK_ROUTE
env variable.modulesDir
- defines the root directory where the modules are located. Can be overriden byVOVK_MODULES_DIR
env variable. Used to watch for changes in the modules and recompile the client. You can set it to"./src"
to watch for changes in the whole project.fetcher
- allows to customize the fetching function that used internally by the client. Can be overriden byVOVK_FETCHER
env variable. See the Customization docs for more info.prefix
- defines the root endpoint used byfetch
function at the client. Can be overriden byVOVK_PREFIX
env variable.validateOnClient
- defines client-side validation library. If vovk-zod (opens in a new tab) is installed butvalidateOnClient
is not redefined it's value going to get value"vovk-zod/zodValidateOnClient"
. Can be overriden byVOVK_VALIDATE_ON_CLIENT
env variable.
The config can be also defined as vovk.config.cjs but also as an ES Module named vovk.config.mjs:
/vovk.config.mjs
/** @type {import('vovk').VovkConfig} */
const vovkConfig = {
// ...
};
export default vovkConfig;