{"id":13495177,"url":"https://github.com/Apodini/ApodiniTemplate","last_synced_at":"2025-03-28T16:31:41.811Z","repository":{"id":40582323,"uuid":"350990061","full_name":"Apodini/ApodiniTemplate","owner":"Apodini","description":"An Apodini web service template","archived":false,"fork":false,"pushed_at":"2022-11-01T00:58:39.000Z","size":51,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2024-08-01T19:54:14.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Apodini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSES/MIT.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-24T07:45:29.000Z","updated_at":"2023-07-03T11:45:01.000Z","dependencies_parsed_at":"2023-01-21T00:16:00.942Z","dependency_job_id":null,"html_url":"https://github.com/Apodini/ApodiniTemplate","commit_stats":null,"previous_names":[],"tags_count":7,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apodini%2FApodiniTemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apodini%2FApodiniTemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apodini%2FApodiniTemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apodini%2FApodiniTemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Apodini","download_url":"https://codeload.github.com/Apodini/ApodiniTemplate/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222395729,"owners_count":16977614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:01:32.084Z","updated_at":"2024-10-31T10:30:36.693Z","avatar_url":"https://github.com/Apodini.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"\u003c!--\n\nThis source file is part of the Apodini Template open source project\n\nSPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) \u003cpaul.schmiedmayer@tum.de\u003e\n\nSPDX-License-Identifier: MIT\n\n--\u003e\n\n# Apodini Template Repository\n\nThis repository includes an example Apodini web service that can be used as a starting point for an Apodini web service.  \n\n## Build an Apodini Web Service\n\nAn Apodini web service is build using [Swift](https://docs.swift.org/swift-book/) and uses [Swift Packages](https://developer.apple.com/documentation/swift_packages). You can learn more about the Swift Package Manager at [swift.org](https://swift.org/package-manager/).\n\n### macOS \u0026 Xcode\n\nIf you use macOS, you can use [Xcode](https://apps.apple.com/de/app/xcode/id497799835) to open the `Package.swift` file at the root of the repository using Xcode. You can learn more on how to use Swift Packages with Xcode on [developer.apple.com](https://developer.apple.com/documentation/xcode/creating_a_standalone_swift_package_with_xcode).\n\n### Visual Studio Code on any operating system\n\nIf you are not using macOS or don't want to use Xcode, you can use [Visual Studio Code](https://code.visualstudio.com) using the [Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) plugin. You must install the latest version of [Visual Studio Code](https://code.visualstudio.com), the latest version of the [Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) plugin and [Docker](https://www.docker.com/products/docker-desktop).\n\n1. Open the folder using Visual Studio Code\n2. If you have installed the [Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) plugin [Visual Studio Code](https://code.visualstudio.com) automatically asks you to reopen the folder to develop in a container at the bottom right of the Visual Studio Code window.\n3. Press \"Reopen in Container\" and wait until the docker container is build\n4. You can now build the code using the [build keyboard shortcut](https://code.visualstudio.com/docs/getstarted/keybindings#_tasks) and run and test the code within the docker container using the Run and Debug area.\n\n### CLion on macOS and Windows\n\nYou can use [CLion with the Swift plugin](https://www.jetbrains.com/help/clion/swift.html) which also works on Windows and [allows you to use the Swift plugin in CLion on Windows ](https://blog.jetbrains.com/objc/2021/03/swift-on-windows-in-clion/)\n\n## Structure\n\nThe web service exposes a RESTful web API and an OpenAPI description:  \n```swift\n@main\nimport Apodini\nimport ApodiniOpenAPI\nimport ApodiniREST\nimport ArgumentParser\n\n\n@main\nstruct ExampleWebService: WebService {\n  @Option(help: \"The port the web service is offered at\")\n  var port: Int = 80\n   \n   \n  var configuration: Configuration {\n    HTTPConfiguration(port: port)\n    REST {\n      OpenAPI()\n    }\n  }\n   \n  var content: some Component {\n    Greeter()\n  }\n}\n```\n\nThe example web service exposes a single `Handler` named `Greeter`:  \n```swift\nstruct Greeter: Handler {\n  @Parameter var name: String = \"World\"\n   \n   \n  func handle() -\u003e String {\n    \"Hello, \\(name)! 👋\"\n  }\n}\n```\n\n### RESTful API\n\nYou can access the `Greeter` `Handler` at `http://localhost/v1`.  \nThe `@Parameter` is exposed as a parameter in the URL. E.g., you can send a request to `localhost/v1?name=Paul` to get the following response:  \n```json\n{\n  \"data\" : \"Hello, Paul! 👋\",\n  \"_links\" : {\n    \"self\" : \"http://127.0.0.1/v1\"\n  }\n}\n```\n\n### OpenAPI\n\nYou can access the OpenAPI document at `http://localhost/openapi`.  \nThe Swagger UI is also automatically generated and accessible at `http://localhost/openapi-ui`.\n\n## Continous Integration\n\nThe repository contains GitHub Actions to automatically build and test the example web service on a wide variety of platforms and configurations.\n\n### Docker\n\nThe template includes docker files and docker compose files to start and deploy a web service.  \nIn addition, the template includes a GitHub Action that builds a new docker image on every release and pushes the image to the GitHub package registry.  \nYou can start up the web service using published docker images using `$ docker compose up` using the `docker-compose.yml` file.  \nThe `docker-compose-development.yml` file can be used to test the setup by building the web service locally using `$ docker compose -f docker-compose-development.yml up`.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FApodini%2FApodiniTemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FApodini%2FApodiniTemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FApodini%2FApodiniTemplate/lists"}