{"id":19756063,"url":"https://github.com/luistar/jakartaee-rest-example","last_synced_at":"2025-05-12T17:14:14.339Z","repository":{"id":212806769,"uuid":"711201773","full_name":"luistar/jakartaee-rest-example","owner":"luistar","description":"A simple REST API implemented with Jakarta EE, including JWT Authentication and client code","archived":false,"fork":false,"pushed_at":"2023-12-16T12:23:08.000Z","size":16,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-12T17:14:08.738Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/luistar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-10-28T14:15:16.000Z","updated_at":"2025-04-28T06:07:49.000Z","dependencies_parsed_at":"2023-12-16T13:33:06.952Z","dependency_job_id":"ff42afda-bf9b-4cd8-9c8a-d969616cc6c8","html_url":"https://github.com/luistar/jakartaee-rest-example","commit_stats":null,"previous_names":["luistar/jakartaee-rest-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luistar%2Fjakartaee-rest-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luistar%2Fjakartaee-rest-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luistar%2Fjakartaee-rest-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luistar%2Fjakartaee-rest-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luistar","download_url":"https://codeload.github.com/luistar/jakartaee-rest-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253785011,"owners_count":21963903,"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-11-12T03:14:37.840Z","updated_at":"2025-05-12T17:14:14.320Z","avatar_url":"https://github.com/luistar.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REST API Example\n\nThis repository contains a simple starter example for implementing a REST API using [Jakarta EE](https://jakarta.ee/specifications/restful-ws/).\nThe example features authentication using JWT, via the [java-jwt](https://github.com/auth0/java-jwt) library by Auth0.\nThe example also includes a built-in [Grizzly](https://projects.eclipse.org/projects/ee4j.grizzly) server to serve the REST API,\nand a Dockerfile to run the REST API in a Docker container.\nLast but not least, a few examples of client code using the developed API are available (see the end of the README).\n\n\n## REST API Endpoints\nThe example includes three endpoints.\n\n### /auth endpoint\nPOST requests with a JSON containing a username and a password can be sent to this endpoint.\nIf the provided user credentials are valid, a JWT is issued and returned in the response.\n\n### /greet endpoint\nThis endpoint supports GET requests. If the requests contain no Authorization \nheader, a default message is returned as a response.\nIf the requests contains a valid JWT, a custom message showing the username \nassociated with the JWT is returned.\n\n### /todo endpoint\nThis endpoint can be used to manage a To-do list. It supports the following methods:\n* `GET /todos`: returns a list of the stored To-do items;\n* `POST /todos`: Expects a JSON with the id, title and description properties in the request body, and saves the new To-do item \nin the list. \n* `DELETE /todos/{id}`: Deletes the To-do Item with the given `{id}`.\n\n## Running the REST API locally (requires Java 17+)\nTo run the REST API locally, build the project using Maven and run the `Main` class \nfrom your IDE.\nBy default, the REST API will be available at [http://localhost:8080/](http://localhost:8080/).\n\n## Running the REST API with Docker\nTo build a docker image, run \n```\ndocker build -t \"todo-rest-api-image\" .\n```\nTo run the image, run\n```\ndocker run -p 9000:8080 -it --name todo-rest-api-container todo-rest-api-image\n```\nThe REST API will be available at [http://localhost:9000/](http://localhost:9000/).\n\n## Client\nThis repository includes also examples on how to write client code that uses the REST API. \nSome tests (see `src/test/java/it/unina/webtech/` show how to write client code using the Jakarta EE Client classes. \nThe example in `/src/main/java/client/Client.java`, on the other hand, uses the \nHttpClient included in the Java Standard library since Java 11.\n\n# Disclaimer\nThe Java code provided in this repository is intended solely for educational purposes.\nIt has been created as an illustrative example to support Computer Science students\nat the *Università degli Studi di Napoli Federico II* in understanding \nspecific programming concepts. \n\nReaders are encouraged to use this code as a reference, a starting point, or \na source of inspiration. However, it is imperative to exercise caution and \ncritical thinking when applying the concepts demonstrated in this code to \nreal-world projects.\n\nThis code contains simplifications, errors, or inefficiencies\nintentionally introduced to highlight specific educational points. As such,\nit should not be considered a definitive or exhaustive example of quality\nprogramming.\nFurthermore, coding practices evolve, and what might be suitable \nfor educational purposes may not necessarily align with industry standards \nor security best practices.\n\nBy accessing and utilizing this code, you acknowledge that it is provided \"as is\" \nwithout any warranties, express or implied, including, but not limited to, the \nimplied warranties of merchantability and fitness for a particular purpose. In no \nevent shall the creators and distributors be liable for any direct, indirect, \nincidental, special, exemplary, or consequential damages arising in any way out \nof the use of this code.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluistar%2Fjakartaee-rest-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluistar%2Fjakartaee-rest-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluistar%2Fjakartaee-rest-example/lists"}