A backend written in Swift using Vapor 4 to use with Apple Music API. Currently supports search only but working on adding a fully functional backend.
- Vapor 4
- An Apple Music JWT Token
- macOS 10.15 or later
- Xcode 11.5 or later
- Swift 5.2
First you need to make sure you install the vapor toolbox. Follow the instructions here
Navigate to the project Root folder and open the Pacakge.swift
file. This should open Xcode.
Alternatively use Terminal and enter open Package.swift
If you are using Xcode you need to add a custom working directory for the juice-backend
scheme's run configuration.
- Go to the scheme selection ( or use the keyboard command
^ + 0
,control + 0
) - Choose
Edit Scheme
- Go to
Run
- Choose
Options
- Set your custom working directory path
Vapor supports .env
, .env.development
, and custom environments for storing data.
Be safe and add all .env
files to your gitignore to avoid checking in any secrets.
Choose the juice-backend
Scheme and build and run the server. That should launch a server at localhost:8080
.
In your Rest Client you can now perform search requests like the following:
localhost:8080/search?term=Tom+Petty&types=artists
The response will be an ResponseRoot
object. See MusicCore for more infomation. Also just drop these classes into your iOS or macOS App to share API responses.