You can use this project if you want to build a local movie API that views all movies and their directors and actors as well as adding and deleting movies that connected to your postgres database🍿.
- Instal Swift and Vapor Toolbox
- Create your Postgres Database
- Clone this project via xcode
- Replace your database configuration in the configure.swift
- Run your project and migrate your database, by running the migrate command in terminal.
You can also run this command through Xcode. The migrate command will check the database to see if any new migrations have been registered since it was last run. If there are new migrations, it will ask for a confirmation before running them.
- The database schema look like this:
Method | URL | Description |
---|---|---|
GET |
/movies |
Retrieve all movies. |
GET |
/movies/id |
Retrieve specific movie by id. |
POST |
/movies |
Add movie. |
GET |
/actor |
Retrieve all actors. |
GET |
/actor/movieId |
Retrieve specific actors by id. |
POST |
/actor |
Add actor. |
GET |
/director |
Retrieve all director. |
GET |
/director/movieId |
Retrieve specific directors by id. |
POST |
/director |
Add director. |