Installation
#
Option 1: Starter templateThe easiest way is to kickoff with the starter template (https://github.com/SwiftAPI/swift-starter).
#
InstallCreate a project and pass the of your project. Run the command below and change project_name to the name of your project.
After running a new directory is created. Type cd project_name
in your terminal (your project's name) to enter the project. This is necessary for the next step.
#
Init databaseMake sure to fill out login detail to a database in /etc/config/database.yaml.
Init the database by running in your terminal from the root of the project.
#
Setup app detailsFill out /etc/config/app.yaml. Make sure to add the right baseurl, otherwise routing won't work.
#
All set!Visit your site site app-domain/hello-world and you should get the following response
From here you can rename the references from MyApp to your own namespace and get going.
- Rename in root services.yaml (this references to destination to the first part of the namespace)
- Rename in App folder
- Rename in app/config.yaml
- Rename namespace of the HelloWorld controller or remove it
#
Option 2: Manual installationThis a bit harder and not recommended, however it is totally possible.
#
InstallGet it from Composer https://packagist.org/packages/swift-api/swift. Only do this if you're quite familiar with Swift.
#
Create right file structureSee https://github.com/SwiftAPI/swift-starter as a reference for setting the right folder structure and files.
#
Init databaseMake sure to fill out login detail to a database in /etc/config/database.yaml
Init the database by running
#
Setup app detailsFill out /etc/config/app.yaml. Make sure to add the right baseurl, otherwise routing won't work.
#
All set!You should be able to create an endpoint now and retrieve responses accordingly.