{"id":21401470,"url":"https://github.com/spoonx/wetland-tutorial","last_synced_at":"2026-01-02T23:14:17.984Z","repository":{"id":149466174,"uuid":"82815005","full_name":"SpoonX/wetland-tutorial","owner":"SpoonX","description":"The source code for the wetland tutorial","archived":false,"fork":false,"pushed_at":"2017-03-08T17:31:21.000Z","size":22,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-23T03:14:52.579Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpoonX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-02-22T14:40:20.000Z","updated_at":"2023-06-21T16:44:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"bd8b1dc3-e00a-435d-9094-802c1e170329","html_url":"https://github.com/SpoonX/wetland-tutorial","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/SpoonX%2Fwetland-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fwetland-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fwetland-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fwetland-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpoonX","download_url":"https://codeload.github.com/SpoonX/wetland-tutorial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243893897,"owners_count":20364919,"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-22T15:27:59.104Z","updated_at":"2026-01-02T23:14:17.954Z","avatar_url":"https://github.com/SpoonX.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wetland tutorial - _Inventory manager_\nThis is the source code for the wetland tutorial, in which we build an inventory manager.\n\nYou can find the [tutorial in the documentation](https://wetland.spoonx.org/Tutorial/setting-up.html).\n\n## Running\nTo get the tutorial application running, follow these steps:\n\n### Clone\nFirst clone this repository to a directory on your machine.\n\n`git clone https://github.com/spoonx/wetland-tutorial`\n\n### Install\nNow install the dependencies, and the wetland cli: `npm i \u0026\u0026 npm i -g wetland`\n\n### Configuration\nBy default this example uses sqlite, and doesn't need any configuration. **To use a different client instead**, perform two simple actions:\n\n1. `npm i mysql --save` _(Or [any other client](https://wetland.spoonx.org/installation.html#your-database))_\n2. Open up `wetland.js` and change the credentials to yours\n\n**Note:** Make sure you have an existing database!\n\n### Schema\nYou might want to see the schema before it gets created, you curious creature!\n\nThe following command dumps the schema it will create for this [dev migration](https://wetland.spoonx.org/snapshots.html#dev-migrations):\n\n`wetland migrator dev -d`\n\n**Note:** dev migrations automatically run every time you start the server\n\n### Run\nThen simply run the server using `npm start`. You can now access the endpoints documented below.\n\n## Endpoints\nTo make it easier to talk to the api, I have created a list of curl commands.\n\n### Create category\n\u003e `POST /category`\n\n```bash\ncurl -XPOST -H 'Content-Type: application/json' -d '{\n  \"name\": \"electronics\"\n}' http://127.0.0.1:3000/category\n```\n### Update category\n\u003e `PATCH /category/:id`\n\n```bash\ncurl -XPATCH -H 'Content-Type: application/json' -d '{\n  \"name\": \"new name\"\n}' http://127.0.0.1:3000/category/1\n```\n\n\n### Create product\n\u003e `POST /product`\n\n```bash\ncurl -XPOST -H 'Content-Type: application/json' -d '{\n  \"name\": \"monitor\",\n  \"categories\": [1]\n}' http://127.0.0.1:3000/product\n```\n### Update product\n\u003e `PATCH /product/:id`\n\n```bash\ncurl -XPATCH -H 'Content-Type: application/json' -d '{\n  \"name\": \"new name\"\n}' http://127.0.0.1:3000/product/1\n```\n\n### Get products\n\u003e `GET /product`\n\n```bash\ncurl http://127.0.0.1:3000/product\n```\n\n### Get product\n\u003e `GET /product/:id`\n\n```bash\ncurl http://127.0.0.1:3000/product/1\n```\n\n### Get categories\n\u003e `GET /category`\n\n```bash\ncurl http://127.0.0.1:3000/category\n```\n\n### Get category\n\u003e `GET /category/:id`\n\n```bash\ncurl http://127.0.0.1:3000/category/1\n```\n\n### Restock product\n\u003e `PATCH /product/:id/restock`\n\n```bash\ncurl -XPATCH -H 'Content-Type: application/json' -d '{\n  \"quantity\": \"2\"\n}' http://127.0.0.1:3000/product/1/restock\n```\n\n### Consume product\n\u003e `PATCH /product/:id/consume`\n\n```bash\ncurl -XPATCH -H 'Content-Type: application/json' -d '{\n  \"quantity\": \"2\"\n}' http://127.0.0.1:3000/product/1/consume\n```\n\n### Get abundant products\n\u003e `GET /product/abundant`\n\n```bash\ncurl http://127.0.0.1:3000/product/abundant\n```\n\n### Get depleted products\n\u003e `GET /product/depleted`\n\n```bash\ncurl http://127.0.0.1:3000/product/depleted\n```\n\n### Get abundant products count\n\u003e `GET /product/abundant/count`\n\n```bash\ncurl http://127.0.0.1:3000/product/abundant/count\n```\n\n### Get depleted products count\n\u003e `GET /product/depleted/count`\n\n```bash\ncurl http://127.0.0.1:3000/product/depleted/count\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Fwetland-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspoonx%2Fwetland-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Fwetland-tutorial/lists"}