- Xcode 16.0
- Vapor 4.99.3
- Open
Package.swift
- Run the project in Xcode to launch the API server
- Ensure a container runtime is running (e.g., Docker Desktop, Lima, OrbStack, etc.)
- Start the
app
service
$ docker compose up app --build
Some APIs interact with a database. If you plan to use these APIs, please start the database server before launching the API server.
- Rename the
.env.example
file to.env
by removing.example
- Ensure a container runtime is running (e.g., Docker Desktop, Lima, OrbStack, etc.)
- Start the
db
service
$ docker compose up db --build
- Start the API server
To verify the server is running correctly, you can send a request to http://127.0.0.1:8080 using curl
. If you receive the response It works!
, the setup is successful (you can also check this by opening http://127.0.0.1:8080 in your browser).
$ curl -v http://127.0.0.1:8080
* Trying 127.0.0.1:8080...
* Connected to 127.0.0.1 (127.0.0.1) port 8080
> GET / HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/8.6.0
> Accept: */*
>
< HTTP/1.1 200 OK
< content-type: text/plain; charset=utf-8
< content-length: 9
< connection: keep-alive
< date: Mon, 23 Sep 2024 21:57:05 GMT
<
* Connection #0 to host 127.0.0.1 left intact
It works!%