{"id":18686659,"url":"https://github.com/danijeldragicevic/code-sharing-platform","last_synced_at":"2026-04-11T06:03:26.887Z","repository":{"id":172155989,"uuid":"612742593","full_name":"danijeldragicevic/code-sharing-platform","owner":"danijeldragicevic","description":"Web application that can share code snippets between collaborators.","archived":false,"fork":false,"pushed_at":"2023-03-13T22:34:59.000Z","size":99,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T18:51:25.893Z","etag":null,"topics":["css","h2-database","html","hyperskill-solutions","java-11","js","lombok","spring-boot","spring-jpa","spring-mvc","spring-validation","thymeleaf"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danijeldragicevic.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-11T20:56:10.000Z","updated_at":"2024-01-15T15:53:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"2bae32b6-927f-4f7a-b991-96872b4f3f01","html_url":"https://github.com/danijeldragicevic/code-sharing-platform","commit_stats":null,"previous_names":["danijeldragicevic/code-sharing-platform"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danijeldragicevic/code-sharing-platform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijeldragicevic%2Fcode-sharing-platform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijeldragicevic%2Fcode-sharing-platform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijeldragicevic%2Fcode-sharing-platform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijeldragicevic%2Fcode-sharing-platform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danijeldragicevic","download_url":"https://codeload.github.com/danijeldragicevic/code-sharing-platform/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijeldragicevic%2Fcode-sharing-platform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31670383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["css","h2-database","html","hyperskill-solutions","java-11","js","lombok","spring-boot","spring-jpa","spring-mvc","spring-validation","thymeleaf"],"created_at":"2024-11-07T10:28:28.456Z","updated_at":"2026-04-11T06:03:26.847Z","avatar_url":"https://github.com/danijeldragicevic.png","language":"Java","readme":"# Code sharing platform\nWeb application that is able to share code between collaborators via API and Web interface. \u003cbr\u003e\nApplication is able to:\n- create new code snippets,\n- set view and time restrictions on created snippets,\n- show snippet by its ID and\n- show all unrestricted code snippets.\n\nApplication use embedded H2 database and no authentication.\n\n# Technology\n- Java 11\n- Spring Boot 2.7.1 (Spring Web MVC, Spring Data Jpa, Spring Validation, Project Lombok, H2 database, Thymeleaf template engine)\n- Gradle 7.4\n\n# To run application:\nNavigate to the project root directory and run **./gradlew bootRun**\n\n# Exposed endpoints:\nBy default, service will run on **http://localhost:8889** \u003cbr/\u003e\nFollowing endpoints will be exposed:\n\n| Methods   | Urls             | Action                                                   |\n|-----------|------------------|----------------------------------------------------------|\n|           |                  |                                                          |\n| GET       | /h2              | Access to the local database (username: sa, no password) |\n|           |                  |                                                          |\n| POST      | /api/code/new    | Create new code snippet                                  |\n| GET       | /api/code/:id    | Get code snippet by it's :id                             |\n| GET       | /api/code/latest | List 10 latest unrestricted code snippets                |\n|           |                  |                                                          |\n| GET       | /code/new        | Create new code snippet                                  |\n| GET       | /code/:id        | Get code snippet by it's :id                             |\n| GET       | /code/latest     | List 10 latest unrestricted code snippets                |\n\n# Examples\n### API calls\n**Example 1:** POST /api/code/new \u003cbr/\u003e\nCreates new code snippet and store it in the local database under the unique UUID. \u003cbr\u003e\nIf time and views are set to zero, or negative value, code snippet don't have any limitations and can be displayed as much as desired. \u003cbr\u003e\nFirst snippet:\n```\n{\n    \"code\": \"public static void main(String[] args) { }\",\n    \"time\": 0,\n    \"views\": 0\n}\n```\nResponse: 200 OK. \u003cbr\u003e\nResponse body:\n```\n{\n    \"id\": \"e9229957-a76a-4c8f-b331-16fae7874044\"\n}\n```\nSecond snippet:\n```\n{\n    \"code\": \"public class CodeSnippet { }\",\n    \"time\": 0,\n    \"views\": 0\n}\n```\nResponse: 200 OK. \u003cbr\u003e\nResponse body:\n```\n{\n    \"id\": \"48bf00d3-c245-47d8-a081-0dc5d2bf44ac\"\n}\n```\nThird snippet:\n```\n{\n    \"code\": \"public class SecretCode { }\",\n    \"time\": 5000,\n    \"views\": 5\n}\n```\nResponse: 200 OK. \u003cbr\u003e\nResponse body:\n```\n{\n    \"id\": \"360f2c38-5d78-4a6d-848f-621c83f24a9b\"\n}\n```\n**Example 2:** GET /api/code/360f2c38-5d78-4a6d-848f-621c83f24a9b \u003cbr\u003e\nShows code snippet by its ID number. \u003cbr\u003e\nResponse: 200 OK. \u003cbr\u003e\nResponse body:\n```\n{\n    \"code\": \"public class SecretCode { }\",\n    \"date\": \"2023-03-13 14:48:39\",\n    \"time\": 4879,\n    \"views\": 4\n}\n```\nIn case that some of snippet's limitation is reached (time to view or number of views), snippet will be deleted. \u003cbr\u003e\nIf same code snippet is requested after it is deleted, an error will be thrown. \u003cbr\u003e\nResponse: 404 Not Found. \u003cbr\u003e\nResponse body:\n```\n{\n    \"time\": \"2023-03-13 14:52:56\",\n    \"status\": 404,\n    \"error\": \"Not Found\",\n    \"message\": \"Code snippet with requested id does not exists!\",\n    \"path\": \"/api/code/360f2c38-5d78-4a6d-848f-621c83f24a9b\"\n}\n```\n**Example 3:** GET /api/code/latest \u003cbr\u003e\nDisplays ten latest code snippets, ordered by date created. \u003cbr\u003e\nOnly unrestricted snippets will be shown, so only snippets whose time/views properties are set to zero (or negative value). \u003cbr\u003e\nResponse 200 OK. \u003cbr\u003e\nResponse body:\n```\n[\n    {\n        \"code\": \"public class CodeSnippet { }\",\n        \"date\": \"2023-03-13 14:57:56\",\n        \"time\": 0,\n        \"views\": 0\n    },\n    {\n        \"code\": \"public static void main(String[] args) { }\",\n        \"date\": \"2023-03-13 14:57:38\",\n        \"time\": 0,\n        \"views\": 0\n    }\n]\n```\n### Web calls\n**Example 1:** POST /code/new \u003cbr\u003e\n![sc1](https://user-images.githubusercontent.com/82412662/224753754-75b635a9-1553-469e-a7e1-06e35d93b5d1.png)\n\n**Example 2:** GET /code/12ee968b-15a4-463f-8bed-cf2303c9f84a \u003cbr\u003e\n![sc2](https://user-images.githubusercontent.com/82412662/224753853-10289d04-d1ae-41cb-ab45-f20653952a15.png)\n\n**Example 3:** GET /code/12ee968b-15a4-463f-8bed-cf2303c9f84a (time to view expired) \u003cbr\u003e\n![sc3](https://user-images.githubusercontent.com/82412662/224753956-57bef0cb-98e0-407f-80e4-95e43580f72b.png)\n\n**Example 4:** GET /code/latest \u003cbr\u003e\n![sc4](https://user-images.githubusercontent.com/82412662/224754030-a672d9a0-0bdc-47d8-88e1-66e5deb33292.png)\n\n# Licence\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanijeldragicevic%2Fcode-sharing-platform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanijeldragicevic%2Fcode-sharing-platform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanijeldragicevic%2Fcode-sharing-platform/lists"}