{"id":16775114,"url":"https://github.com/juangesino/express-gpio-rest-api","last_synced_at":"2025-06-26T21:33:33.945Z","repository":{"id":79339608,"uuid":"51128885","full_name":"juangesino/express-gpio-rest-api","owner":"juangesino","description":"Express server for a RESTful API to access the Raspberry Pi's GPIO pins.","archived":false,"fork":false,"pushed_at":"2016-02-05T19:26:43.000Z","size":3,"stargazers_count":8,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-24T02:03:01.608Z","etag":null,"topics":["express","gpio-pins","nodejs","raspberry-pi","rest-api"],"latest_commit_sha":null,"homepage":"","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/juangesino.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}},"created_at":"2016-02-05T05:57:20.000Z","updated_at":"2025-06-21T19:38:50.000Z","dependencies_parsed_at":"2023-02-24T19:00:32.056Z","dependency_job_id":null,"html_url":"https://github.com/juangesino/express-gpio-rest-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/juangesino/express-gpio-rest-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juangesino%2Fexpress-gpio-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juangesino%2Fexpress-gpio-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juangesino%2Fexpress-gpio-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juangesino%2Fexpress-gpio-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juangesino","download_url":"https://codeload.github.com/juangesino/express-gpio-rest-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juangesino%2Fexpress-gpio-rest-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262145201,"owners_count":23265892,"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":["express","gpio-pins","nodejs","raspberry-pi","rest-api"],"created_at":"2024-10-13T06:51:02.962Z","updated_at":"2025-06-26T21:33:33.919Z","avatar_url":"https://github.com/juangesino.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express GPIO RESTful API\n\nExpress server script for a RESTful API to access the Raspberry Pi's GPIO pins.\n\nTurn pins on and off by sending GET requests to the Raspberry Pi.\n\n## Installation\nFirst, make sure you have node.js and npm installed.\n\nIf you don't, open a terminal and type:\n\n    sudo apt-get install nodejs npm node-semver\n\nNow we need to allow your user to access the GPIO pins (can only be done from root by default). We are going to use GPIO Admin for that:\n\n    git clone git://github.com/juangesino/quick2wire-gpio-admin.git\n    cd quick2wire-gpio-admin\n    make\n    sudo make install\n    sudo adduser $USER gpio\n\nLogout and login again ([more info](https://github.com/juangesino/quick2wire-gpio-admin)).\n\nNow we are ready to clone the server.\n\n    git clone https://github.com/juangesino/express-gpio-rest-api.git\n    cd express-gpio-rest-api\n    npm install\n\nTo run the script:\n\n    node app.js\n\n## Usage\n\nThe server has 3 simple routes:\n\n    GET /on/:pin_number\n    GET /off/:pin_number\n    GET /blink/:pin_number/:time_in_milliseconds\n\nThe first method just sets the pin HIGH.\n\nThe second method sets the pin LOW.\n\nThe third method sets the pin HIGH, waits the number of milliseconds you requested and then sets the pin LOW.\n\nThe server script uses the node.js library [pi-gpio](https://www.npmjs.com/package/pi-gpio). This library uses the physical pin numbering (the '*Pin#*' in the image bellow) for the GPIO pins:\n\n![Raspberry Pi GPIO Header](http://i0.wp.com/www.robert-drummond.com/wp-content/uploads/2015/06/gpio_pi2-pinout.png?w=956)\n\nFor more information about what pins to use please go to the [pi-gpio docs](https://www.npmjs.com/package/pi-gpio#about-the-pin-configuration).\n\n## Examples\n\nThe server runs by default on port 3000 (you can change this on the app.js file).\n\nThe requests should be done to the Raspberry Pi's IP address (e.g.: *192.168.0.10:3000*).\n\n**Turn pin 12 on**\n\n    GET /on/12\n\n**Turn pin 12 off**\n\n    GET /off/12\n\n**Turn pin 12 on for 2 seconds, then turn off**\n\n    GET /blink/12/2000\n\n## Contributing\n\n1. Fork it ( https://github.com/juangesino/express-gpio-rest-api/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## TODO\n\n - Read pins.\n - Check for bad params.\n - GET request should show the pin state and PUT should be used to change state.\n - Blink a given number of times.\n - Inverse blink (turn off, wait, turn on).\n - Write tests.\n\n## License\n\nSee [MIT-LICENSE](https://github.com/juangesino/express-gpio-rest-api/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuangesino%2Fexpress-gpio-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuangesino%2Fexpress-gpio-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuangesino%2Fexpress-gpio-rest-api/lists"}