A Vapor template for convenient and fast scaffolding 🏎
This template has everything ready to go. Just create a new project using Vapor toolbox.
vapor new MyApp --template=nodes-vapor/template
The two keys in crypto.json
needs to be updated. You can use openssl rand -base64 <length>
to generate random strings. You can use length 10 for the key in the hash
object and you can use length 32 for the key in the cipher
object.
Before running your project, you need to make sure you have the following environment variables setup. For more information on how do this, have a look at our guide here.
app.json
$PROJECT_NAME
: Name of your project.$PROJECT_URL
: Url for your project - there should most likely be one value per environment.
bugsnag.json
$BUGSNAG_KEY
: API key for Bugsnag.
mysql.json
$DATABASE_HOSTNAME
: Hostname for MySQL (this will fallback to127.0.0.1
).$DATABASE_USER
: User for MySQL (this will fallback toroot
).$DATABASE_PASSWORD
: Password for MySQL (this will fallback to ``, which is the empty string).$DATABASE_DB
: Database name for project in MySQL (this will fallback tomy-project
).
redis.json
$REDIS_HOSTNAME
: Hostname for Redis (this will fallback to127.0.0.1
).$REDIS_DATABASE
: Redis database.
The project is split up into two modules: Run
and MyProject-Package
. Run
contains the main.swift
and is used for building the main executable. MyProject-Package
is where all of your server's code will be and is the module used for tests. When you add a source file to your project please make sure it's a member of the MyProject-Package
module.
Vapor toolbox makes it simple to generate a project for Xcode.
vapor xcode -y
In Xcode, select the Run
scheme if you want to startup your server.
For testing, make sure to have the MyProject-Package
scheme selected. Then, you can use ⌘U
like usual.
This package is developed and maintained by the Vapor team at Nodes. The package owner for this project is Steffen.
This package is open-sourced software licensed under the MIT license