{"id":16059058,"url":"https://github.com/andyatkinson/my-retail-dropwizard","last_synced_at":"2025-04-05T08:16:05.472Z","repository":{"id":44653538,"uuid":"122289797","full_name":"andyatkinson/my-retail-dropwizard","owner":"andyatkinson","description":"Java DropWizard web app","archived":false,"fork":false,"pushed_at":"2022-09-22T18:23:56.000Z","size":24,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T15:50:47.960Z","etag":null,"topics":["dropwizard","java","jdbi"],"latest_commit_sha":null,"homepage":"","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/andyatkinson.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}},"created_at":"2018-02-21T03:55:24.000Z","updated_at":"2020-03-23T18:47:57.000Z","dependencies_parsed_at":"2023-01-18T16:45:58.566Z","dependency_job_id":null,"html_url":"https://github.com/andyatkinson/my-retail-dropwizard","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyatkinson%2Fmy-retail-dropwizard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyatkinson%2Fmy-retail-dropwizard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyatkinson%2Fmy-retail-dropwizard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyatkinson%2Fmy-retail-dropwizard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andyatkinson","download_url":"https://codeload.github.com/andyatkinson/my-retail-dropwizard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305946,"owners_count":20917208,"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":["dropwizard","java","jdbi"],"created_at":"2024-10-09T03:41:37.797Z","updated_at":"2025-04-05T08:16:05.451Z","avatar_url":"https://github.com/andyatkinson.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MyRetail\n\n\n## How to start the MyRetail application\n\n1. `mvn package`\n1. `java -jar target/my-retail-dropwizard-1.0-SNAPSHOT.jar server config.yml`\n1. Visit `http://localhost:8080/products/1` (see curl example below)\n\n## Running Tests\n\n`mvn test`\n\n\n## Local DB setup, manual creation\n\n - `create database my_retail_dropwizard;`\n - Create products table\n\n\n```sql\nCREATE TABLE products (\n    id bigint NOT NULL,\n    external_id integer NOT NULL,\n    price_details jsonb\n);\n\n\nALTER TABLE products OWNER TO andy;\n\nCREATE SEQUENCE products_id_seq\n    START WITH 1\n    INCREMENT BY 1\n    NO MINVALUE\n    NO MAXVALUE\n    CACHE 1;\n\n\nALTER TABLE products_id_seq OWNER TO andy;\n\nALTER SEQUENCE products_id_seq OWNED BY products.id;\n\nALTER TABLE ONLY products ALTER COLUMN id SET DEFAULT nextval('products_id_seq'::regclass);\n\nALTER TABLE ONLY products\n    ADD CONSTRAINT products_pkey PRIMARY KEY (id);\n\nCREATE INDEX index_products_on_external_id ON products USING btree (external_id);\n```\n\n\n\n - Insert some product records, with price details\n \n```sql\ninsert into products (id,external_id,price_details) VALUES (1, 15117729, '{\"value\": 13.49, \"currency_code\": \"USD\"}');\ninsert into products (id,external_id) VALUES (2, 16483589);\ninsert into products (id,external_id) VALUES (3, 16696652);\ninsert into products (id,external_id) VALUES (4, 16752456);\ninsert into products (id,external_id) VALUES (5, 15643793);\ninsert into products (id,external_id) VALUES (6, 13860428);\n```\n\n## DB setup with Liquibase\n\nCheck the database status\n\n```\n$ java -jar target/my-retail-dropwizard-1.0-SNAPSHOT.jar db status config.yml\n1 change sets have not been applied to andy@jdbc:postgresql://localhost/my_retail_dropwizard\n```\n\n\n## Curl examples\n\n```\ncurl -X GET \\\n  http://localhost:8080/products/15117729 \\\n  -H 'content-type: application/json'\n```\n\n### JSON HTTP requests and JSON parsing \n\nAdded dependencies Unirest and JsonPath to make it easier to load and parse JSON, and drill into deeply nested structures.\n\n### Benchmarking\n\nBenchmarking with wrk\n\n```\n$ wrk -t1 -c10 -d10s http://127.0.0.1:8080/products/15117729\nRunning 10s test @ http://127.0.0.1:8080/products/15117729\n  1 threads and 10 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency   273.07ms  368.96ms   1.97s    85.54%\n    Req/Sec    73.00     52.65   191.00     56.10%\n  621 requests in 10.06s, 143.73KB read\n  Socket errors: connect 0, read 0, write 0, timeout 1\nRequests/sec:     61.73\nTransfer/sec:     14.29KB\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyatkinson%2Fmy-retail-dropwizard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandyatkinson%2Fmy-retail-dropwizard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyatkinson%2Fmy-retail-dropwizard/lists"}