/swift-training-backend

Backend in Swift for Swift Wolox Trainings that simulates WBooks app: for renting books.

Primary LanguageSwift

swift-training-backend

Backend for WBooks iOS Training, made entirely in Swift.

Requirements

  • Swift 4.x

Documentation

  • Apiary: Here you will find all the information necessary to interact with the API.

API

The app is now running on Heroku. You can interact with it through this URL:

https://swift-training-backend.herokuapp.com/

Example

curl https://swift-training-backend.herokuapp.com/books

DER

alt text

Running locally

Run the following script to set up the project:

sh Scripts/complete_installation

Once finished, you can now run the project with:

vapor run

If you want to fill the database with made-up data, keep the app running and exectute this on another terminal:

sh Scripts/insert_data

All done! You're ready to start using the API :)


Deploying to Heroku

  1. Install Heroku CLI:
brew install heroku/brew/heroku

  1. Log in to Heroku:
heroku login

  1. Ask your Team Leader to be added as a Collaborator. This will give you the proper permissions to push to the Heroku repository.

  1. After you have been added as a Collaborator, add the remote repository:
heroku git:remote -a swift-training-backend

  1. Well done! You are ready to deploy. In order to do so, run the following command:
vapor heroku push

It might take a while, but in the meantime you can check out the build logs from the Dashboard.


Logs

You can see the remote logs with the following command:

heroku logs --tail

Issues with Xcode?

If Xcode doesn't show the correct files, or the project structure seems wrong, just run the following command:

vapor update -y

This will update dependencies and create the appropiate Xcode project files. Xcode will restart after the command executes.