This package installs a few helpful commands to help you bootstrap your Vapor application.
Add the adapter in your dependencies array in Package.swift:
dependencies: [
// ...,
.package(url: "https://github.com/lloople/vapor-maker-commands.git", from: "1.0.0")
],
Also ensure you add it as a dependency to your target:
targets: [
.target(name: "App", dependencies: [
.product(name: "VaporMakerCommands", package:"vapor-maker-commands")
.product(name: "Vapor", package: "vapor"),
// ...,
]),
// ...
]
Register the commands in your configure.swift
file:
app.registerMakerCommands()
Creates a new controller type inside Sources/App/Controllers
path. --rest
flag adds the default CRUD
methods for your controller actions.
vapor run make:controller UsersController
vapor run make:controller PostsController --rest
vapor run make:controller PlayersController --boot
Creates a new command type inside Sources/App/Commands
path.
vapor run make:command CreateUserCommand
Creates a new content type inside Sources/App/Contents
path. --with-validation
flag adds the Validatable
extension to your content.
vapor run make:content UserContent
vapor run make:content UserContent --with-validation
Creates a new custom leaf tag type inside Sources/App/LeafTags
path.
vapor run make:leaf-tag CopyrightTag
Creates a new middleware type inside Sources/App/Middlewares
path. --after
flag will guide you on how to modify the response to be returned from your middleware.
vapor run make:middleware UserIsAdminMiddleware
vapor run make:middleware AddUserToResponseMiddleware --after
Creates a new migration type inside Sources/App/Migrations
path.
vapor run make:migration UsersMigration
Creates a new model type inside Sources/App/Models
path.
vapor run make:model User
All commands come with a --force
flag to override existing files.