Azion CLI dev
Azion CLI command that builds a project and serves it on a local development server, with every flag, its type, and its default.
The Azion CLI dev command builds the project in the current directory and starts a local development server, so you can test an application or a function on your machine before you deploy it. Run it from the root folder of a project that Azion CLI init created or that Azion CLI link set up. For an existing project that is not set up for Azion, run azion link first. The options every command accepts, such as --debug, --format, and -y, are on Global options.
Usage
azion dev builds the project with the preset in its configuration, then serves the build on http://localhost:3333:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--port | — | int | 3333 | Port the development server listens on. |
--skip-framework-build | — | — | — | Skips the framework build phase. |
After the first build, the command prints Initial scan complete. Ready for changes. and watches the project. When a file changes, it prints Rebuilding with the new changes..., builds the project again, and serves the new build on the same port. The server keeps running until you stop it.
Examples
Each example shows the command and the output it prints.
Run a function locally
This command starts the development server for a JavaScript project that azion init created from the Hello World template:
The command builds the function and prints the address of the server:
While the server runs, send a request to it from another terminal. The function in this project returns a message, the request path, and the request method as JSON:
Serve a static site on another port
This command starts the development server for an HTML site on port 4444 instead of the default port:
The last lines of the output show the port you passed:
A request to the root of the site on that port returns status 200: