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

OptionArgumentDescriptionDefault
-p, --portA numberPort to listen on3000
-h, --hostA stringHost to listen onlocalhost
-e, --entryA list of strings separated by a commaThe 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"
--watchOptional The directory to watch for changesWatch for changes in the target directorynot provided. If the option is present, defaults to the entry file found
--tunnelOptional The tunnel type (see the tunnel option in the configuration)Use a tunnel to access the servernot provided. If the option is present, defaults to the localtunnel tunnel
--allow-unsafeAllow loading routes from node_modulesfalse