{"id":20650738,"url":"https://github.com/or-abdillh/stock-api","last_synced_at":"2025-04-17T05:57:44.278Z","repository":{"id":110204061,"uuid":"414505999","full_name":"or-abdillh/stock-api","owner":"or-abdillh","description":"Backend service for Stock App using NodeJS , ExpressJS, and MySQL","archived":false,"fork":false,"pushed_at":"2021-11-13T03:02:00.000Z","size":10726,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T06:04:25.431Z","etag":null,"topics":["api","expressjs","inventory","inventory-management","nodejs","nodejs-server","rest-api","restful-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/or-abdillh.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":"2021-10-07T07:41:06.000Z","updated_at":"2023-10-27T16:16:34.000Z","dependencies_parsed_at":"2023-07-06T08:01:23.596Z","dependency_job_id":null,"html_url":"https://github.com/or-abdillh/stock-api","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/or-abdillh%2Fstock-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/or-abdillh%2Fstock-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/or-abdillh%2Fstock-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/or-abdillh%2Fstock-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/or-abdillh","download_url":"https://codeload.github.com/or-abdillh/stock-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249319203,"owners_count":21250496,"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":["api","expressjs","inventory","inventory-management","nodejs","nodejs-server","rest-api","restful-api"],"created_at":"2024-11-16T17:22:32.682Z","updated_at":"2025-04-17T05:57:44.255Z","avatar_url":"https://github.com/or-abdillh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch3 align=\"center\"\u003eStock API\u003c/h3\u003e\n\u003cp align=\"center\"\u003eAplication Backend For Stock App\u003c/p\u003e\n\n### About\nThis application is used to serve data requests from the Stock-App client application to the server. \nBuilt with Node JS, Express JS and MySql\n\n### Dependencies\n- body parser v.1.19.0\n- cors v.2.8.5\n- express v.4.17.1\n- express fileupload v.1.2.1\n- md5 v.2.3.0\n- mysql v.2.18.1\n- random token v.0.0.8\n- nodemon 2.0.13\n\n### How to start\n- Use this command for cloning this repository \u003ccode\u003egit clone https://github.com/or-abdillh/stock-api.git\u003c/code\u003e\n- Then, use this command \u003ccode\u003ecd stock-api\u003c/code\u003e\n- Install all dependencies \u003ccode\u003enpm install\u003c/code\u003e\n\n### Running The Server\n- Make sure you have exported the database using this file \u003ccode\u003e./DB/stockAppDB.sql\u003c/code\u003e\n- Running the mysql services if you use mysql CLI with this command \u003ccode\u003emysqld_safe\u003c/code\u003e\n- Before running the server you must setup the configuration connection to your mysql in \u003ccode\u003e./connection/conn.js\u003c/code\u003e\n- Then, use this command to run server \u003ccode\u003enpm start\u003c/code\u003e\n- By default the server running on PORT 8080, you can change the PORT in \u003ccode\u003e./server.js\u003c/code\u003e\n\u003cimg src=\"./public/running-server.jpg\" width=\"100%\"\u003e\n\n### Hostname \u0026 Endpoint API\n- HOSTNAME : \u003ccode\u003ehttp://localhost:8080/\u003c/code\u003e\n\n##### endpoint\n- \u003ccode\u003e/\u003c/code\u003e \u003cbr/\u003e\npurpose : Testing response from server\n\n- \u003ccode\u003e/auth\u003c/code\u003e \u003cbr/\u003e \npurpose : login validation \u003cbr/\u003e \nrequest method \u003ccode\u003ePOST \u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/token\u003c/code\u003e \u003cbr/\u003e \npurpose : Token validation \u003cbr/\u003e \nrequest method \u003ccode\u003ePOST\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/logout\u003c/code\u003e \u003cbr/\u003e \npurpose : Remove TOKEN and create new TOKEN to table User \u003cbr/\u003e \nrequest method \u003ccode\u003eGET\u003c/code\u003e\n\n- \u003ccode\u003e/profile\u003c/code\u003e \u003cbr/\u003e \npurpose : Get fullname, amounts of category and products user have \u003cbr/\u003e \nrequest method \u003ccode\u003eGET\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/products\u003c/code\u003e \u003cbr/\u003e \npurpose : Get all products from table Products \u003cbr/\u003e \nrequest method \u003ccode\u003eGET\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/upload\u003c/code\u003e \u003cbr/\u003e \npurpose : Upload image to server, path uploaded file \u003ccode\u003e/public\u003c/code\u003e \u003cbr/\u003e \nrequest method \u003ccode\u003ePOST\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/createProduct\u003c/code\u003e \u003cbr/\u003e \npurpose : Create new product \u003cbr/\u003e \nrequest method \u003ccode\u003ePOST\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/removeFile\u003c/code\u003e \u003cbr/\u003e \npurpose : Remove file image from server \u003cbr/\u003e \nrequest method \u003ccode\u003eDELETE\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/deleteProduct\u003c/code\u003e \u003cbr/\u003e \npurpose : remove product from table Products \u003cbr/\u003e \nrequest method \u003ccode\u003eDELETE\u003c/code\u003e \u003cbr/\u003e\n\n- \u003ccode\u003e/updateProduct\u003c/code\u003e \u003cbr/\u003e \npurpose : update product from table Products \u003cbr/\u003e \nrequest method \u003ccode\u003ePOST\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/categorys\u003c/code\u003e \u003cbr/\u003e \npurpose : Get all categorys from table Categorys \u003cbr/\u003e \nrequest method \u003ccode\u003eGET\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/createCategory\u003c/code\u003e \u003cbr/\u003e \npurpose : Create new category \u003cbr/\u003e \nrequest method \u003ccode\u003ePOST\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/deleteCategory\u003c/code\u003e \u003cbr/\u003e \npurpose : Remove category from table Categorys \u003cbr/\u003e \nrequest method \u003ccode\u003eDELETE\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/setUncategorys\u003c/code\u003e \u003cbr/\u003e \npurpose : Set name category product to uncategorys after the current category has deleted\u003cbr/\u003e \nrequest method \u003ccode\u003ePOST\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/updateCategory\u003c/code\u003e \u003cbr/\u003e \npurpose : Update the category from table Categorys\u003cbr/\u003e \nrequest method \u003ccode\u003ePOST\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/search/:keyword/:category\u003c/code\u003e \u003cbr/\u003e \npurpose : Get products by keyword and category product \u003cbr/\u003e \nrequest method \u003ccode\u003eGET\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/changeName\u003c/code\u003e \u003cbr/\u003e \npurpose : Update name user \u003cbr/\u003e \nrequest method \u003ccode\u003ePOST\u003c/code\u003e \u003cbr/\u003e \n\n- \u003ccode\u003e/changePassword\u003c/code\u003e \u003cbr/\u003e \npurpose : Change password user \u003cbr/\u003e \nrequest method \u003ccode\u003ePOST\u003c/code\u003e \u003cbr/\u003e \n\n### Example request\nEvery time you make a request there must be a token in the request header as an identifier \u003cbr/\u003e\n```javascript\n   import BASE_URL from '../BASE_URL.js'\n   \n   //Create Headers to save the token\n   const headers = {\n      headers: { \n         token: 'Get the token from auth endpoint' \n      } \n   }\n   \n   axios.get(`${BASE_URL}/products`, headers)\n      .then(res =\u003e {\n         console.log(res.data)\n      })\n      .catch(err =\u003e {\n         console.error(err)\n      })\n```\n\n### Example response \n- from \u003ccode\u003e/auth\u003c/code\u003e\n```json\n{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"results\": {\n        \"TOKEN\": \"7yyxswvcj6ivjp8c0p6tqult94nx3kbjgetb9tpzfs0tug3f9d4cjsdd9f86otohoa7gc369ukyadztalgjbq20vjxwqeno3dp4z\"\n    }\n}\n```\n\n- from \u003ccode\u003e/profile\u003c/code\u003e\n```json\n    {\n      \"status\": 200, \n      \"message\": \"success\",\n      \"results\": {\n         \"fullname\": \"Sandhika Galih\",\n         \"products\": \"45\"\n         \"categorys\": \"5\"\n      }\n   }\n```\n- from \u003ccode\u003e/products\u003c/code\u003e\n```json\n{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"results\": [\n        {\n            \"id_product\": 76,\n            \"name_product\": \"Happy Cuan Figma UI Kits\",\n            \"price_product\": 567000,\n            \"stock_product\": 2,\n            \"image_product\": \"http://localhost:8080/public/product-1635568922040.jpg\",\n            \"category_product\": \"UI\",\n            \"last_modified\": 1635585093337,\n            \"stock_unit\": \"pcs\"\n        }\n    ]\n}\n```\n### Thanks \n- Support me with a cup of coffee and other snacks [here ..](https://saweria.co/orabdillh)\n- Don't forget to give me star in this repository 🙏🏻🙏🏻\n- See my other projects on instagram [@or_abdillh](http://www.instagram.com/or_abdillh)\n\n[Oka R Abdillah ](http://github.com/or-abdillh) \u003cbr/\u003e \nLast edited on : 31/10/2021","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2For-abdillh%2Fstock-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2For-abdillh%2Fstock-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2For-abdillh%2Fstock-api/lists"}