{"id":13605089,"url":"https://github.com/larsks/micropython-noggin","last_synced_at":"2026-03-06T19:35:36.577Z","repository":{"id":66821069,"uuid":"110710593","full_name":"larsks/micropython-noggin","owner":"larsks","description":null,"archived":false,"fork":false,"pushed_at":"2017-11-17T01:36:22.000Z","size":70,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-01T20:05:50.939Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/larsks.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}},"created_at":"2017-11-14T15:48:09.000Z","updated_at":"2023-08-28T04:58:53.000Z","dependencies_parsed_at":"2024-01-07T21:53:21.231Z","dependency_job_id":"5e6f2355-961c-4fe2-a328-ef65748196ce","html_url":"https://github.com/larsks/micropython-noggin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/larsks/micropython-noggin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larsks%2Fmicropython-noggin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larsks%2Fmicropython-noggin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larsks%2Fmicropython-noggin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larsks%2Fmicropython-noggin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/larsks","download_url":"https://codeload.github.com/larsks/micropython-noggin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larsks%2Fmicropython-noggin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30193651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-08-01T19:00:54.559Z","updated_at":"2026-03-06T19:35:36.560Z","avatar_url":"https://github.com/larsks.png","language":"Python","readme":"# Noggin: A very simple web server for MicroPython\n\n## Installation\n\nYou need to get the `noggin` directory onto your MicroPython board.  I\nuse the `ampy` command for this:\n\n    ampy -p /dev/ttyUSB0 -b 115200 put noggin\n\nThere is a [Makefile](Makefile) in the repository that will compile all the\nPython to byte code and then install it on your board, but it relies\non a [patched version of ampy][] so I don't recommend you use it at\nthis time.\n\n[patched version of ampy]: https://github.com/adafruit/ampy/pull/33\n\n## Overview\n\nWorking with Noggin is very simple.  Start by importing a few things\nfrom the module:\n\n    from noggin import Noggin, Response, HTTPError\n\nCreate a new Noggin instance:\n\n    app = Noggin()\n\nDefine some functions and map them to request paths.  Your function\nmay return a text value to send that text to the client:\n\n    @app.route('/device/([^/]+)/([^/]+)')\n    def device_info(req, dev_type, dev_id):\n        return 'You asked about device type {}, device id {}'.format(\n            dev_type, dev_id)\n\nOr you can return a dictionary or list to return JSON to the cilent:\n\n    @app.route('/device/([^/]+)/([^/]+)')\n    def device_info(req, dev_type, dev_id):\n        return {'dev_type': dev_type, 'dev_id': dev_id'}\n\nTo run your app, call the `serve` method.  You may optionally provide\na port:\n\n    app.serve(port=8080)\n\nUse the `HTTPError` exception to return errors to the client:\n\n    @app.route('/value/(.*)')\n    def get_value(req, sensor):\n        if sensor not in active_sensors:\n            raise HTTPError(404)\n\nUse the `Response` class if you want to set the returned content type\nor other headers:\n\n    @app.route('/')\n    def index(req):\n        return Response('\u003cstrong\u003eThis\u003c/strong\u003e is a test',\n                        content_type='text/html')\n\n## Examples\n\n### The demo app\n\nInstall the demo app. I like to use [ampy][]:\n\n[ampy]: https://github.com/adafruit/ampy\n\n    ampy -p /dev/ttyUSB0 -b 115200 put examples/demo.py demo.py\n\nNow you can run the demo.  On your MicroPython board, import the\nexample application:\n\n    \u003e\u003e\u003e import demo\n    \u003e\u003e\u003e demo.app.serve()\n\nThis will start a web server on port 80.  See the docstrings \n[in the source][] for more information about available request\nmethods.\n\n[in the source]: examples/demo.py\n\n###  The fileops app\n\nThe `fileops` app implements a simple web interface to the filesystem.\nIt supports the following requests:\n\n- `GET /disk` -- get information about the filesystem\n- `GET /disk/free` -- get available free space (in blocks and bytes)\n- `GET /file` -- get a list of files\n- `PUT /file/\u003cpath\u003e` -- write a file to the filesystem\n- `POST /file/\u003cpath\u003e` -- rename a file (new filename is `POST` body)\n- `DELETE /file/\u003cpath\u003e` -- delete a file\n- `GET /reset` -- execute `machine.reset()`\n\nTo install the `fileops` app:\n\n    ampy -p /dev/ttyUSB0 -b 115200 put examples/fileops.py fileops.py\n\nTo run the `fileops` app:\n\n    \u003e\u003e\u003e import fileops\n    \u003e\u003e\u003e fileops.app.serve()\n\n","funding_links":[],"categories":["Networking","Libraries"],"sub_categories":["Communications"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarsks%2Fmicropython-noggin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flarsks%2Fmicropython-noggin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarsks%2Fmicropython-noggin/lists"}