← 返回命令列表

Linux command

vapor 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Create new Vapor project

vapor new [ProjectName]

Create project with a custom template

vapor new [ProjectName] --template [https://github.com/user/template.git]

Create project with automatic "no" to all prompts

vapor new [ProjectName] -n

Create project in a specific output directory

vapor new [ProjectName] --output [path/to/directory]

Create project without initializing a Git repository

vapor new [ProjectName] --no-git

说明

vapor is the command-line toolbox for the Vapor web framework, a server-side Swift HTTP framework. The toolbox's primary purpose is creating new Vapor projects from templates. The new command is the default subcommand and can be omitted. Projects are created from templates that include routing, middleware, and optionally Fluent ORM for database operations. The toolbox supports dynamic project generation through manifest files (YAML or JSON) that define variables and conditional file inclusion based on user responses. Once a project is created, you use Swift Package Manager directly (`swift build`, `swift run`) to build and run the application.

参数

-n
Automatically answer "no" to all interactive questions.
--output _path_
Specify a custom folder location for the new project.
--template _url_
Use a custom template from a Git repository URL.
--branch _name_
Specify a different Git branch for the template (default: main).
--no-git
Skip Git repository initialization.
--no-commit
Initialize Git but skip the initial commit.
--help
Display help information.

FAQ

What is the vapor command used for?

vapor is the command-line toolbox for the Vapor web framework, a server-side Swift HTTP framework. The toolbox's primary purpose is creating new Vapor projects from templates. The new command is the default subcommand and can be omitted. Projects are created from templates that include routing, middleware, and optionally Fluent ORM for database operations. The toolbox supports dynamic project generation through manifest files (YAML or JSON) that define variables and conditional file inclusion based on user responses. Once a project is created, you use Swift Package Manager directly (`swift build`, `swift run`) to build and run the application.

How do I run a basic vapor example?

Run `vapor new [ProjectName]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -n do in vapor?

Automatically answer "no" to all interactive questions.