Swiftpack.co - Package - OliverWangHansen/yoyo-vapor

Nodes Vapor Template

Swift Version Vapor Version Linux Build Status macOS Build Status codebeat badge codecov Readme Score GitHub license

A Vapor template for convenient and fast scaffolding 🏎

📦 Installation

This template has everything ready to go. Just create a new project using Vapor toolbox.

vapor new MyApp --template=nodes-vapor/template

Getting started 🚀

Crypto

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.

Environment variables

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 to 127.0.0.1).
    • $DATABASE_USER: User for MySQL (this will fallback to root).
    • $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 to my-project).
  • redis.json
    • $REDIS_HOSTNAME: Hostname for Redis (this will fallback to 127.0.0.1).
    • $REDIS_DATABASE: Redis database.

Environment variables related to MySQL and Redis will be set automatically if you use e.g. Vapor Cloud. All other variables needs to be set manually, e.g. through the CLI tool. For more information, have a look at the official Vapor Cloud docs.

Project layout 🗂

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.

Xcode project 🔨

Vapor toolbox makes it simple to generate a project for Xcode.

vapor xcode -y

Starting your server 🏁

In Xcode, select the Run scheme if you want to startup your server.

Testing your code ⏱

For testing, make sure to have the MyProject-Package scheme selected. Then, you can use ⌘U like usual.

🏆 Credits

This package is developed and maintained by the Vapor team at Nodes. The package owner for this project is Steffen.

📄 License

This package is open-sourced software licensed under the MIT license

Github

link
Stars: 0
Help us keep the lights on

Used By

Total: