CLI
To make it easier to use Agrume, we provide a CLI. For example, you can use the CLI to start the server separately from the frontend.
If you use Vite, you don’t need to use the CLI necessarily because the Agrume plugin for Vite registers the routes on the Vite server. However, some tools don’t allow registering custom routes, so you can use the CLI to start the server separately.
Installation
pnpm add -D @agrume/cli
Note
You can also install the CLI globally by using the -g
flag.
Usage
You can use the CLI to start the server:
agrume
It will find the routes in your project and start the server.
Options
Option | Argument | Description | Default |
---|---|---|---|
-p , --port | A number | Port to listen on | 3000 |
-h , --host | A string | Host to listen on | localhost |
-e , --entry | A list of strings separated by a comma | The entry files to search for routes | "index.js,index.ts,index.jsx,index.tsx,main.js,main.ts,main.jsx,main.tsx,app.js,app.ts,app.jsx,app.tsx,src/index.js,src/index.ts,src/index.jsx,src/index.tsx,src/main.js,src/main.ts,src/main.jsx,src/main.tsx,src/app.js,src/app.ts,src/app.jsx,src/app.tsx" |
--watch | Optional The directory to watch for changes | Watch for changes in the target directory | not provided. If the option is present, defaults to the entry file found |
--tunnel | Optional The tunnel type (see the tunnel option in the configuration) | Use a tunnel to access the server | not provided. If the option is present, defaults to the localtunnel tunnel |
--allow-unsafe | Allow loading routes from node_modules | false |