{"id":26214756,"url":"https://github.com/webkom/readme-as-a-function","last_synced_at":"2025-04-15T18:42:04.718Z","repository":{"id":46972057,"uuid":"150498922","full_name":"webkom/readme-as-a-function","owner":"webkom","description":"📰 readme as a (graphql) function","archived":false,"fork":false,"pushed_at":"2021-09-19T21:11:18.000Z","size":99,"stargazers_count":5,"open_issues_count":5,"forks_count":2,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-28T23:44:04.732Z","etag":null,"topics":["api","faas","function","golang","graphql","serverless"],"latest_commit_sha":null,"homepage":" https://readme-as-a-function.abakus.no","language":"Go","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/webkom.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":"2018-09-26T22:49:52.000Z","updated_at":"2023-05-06T12:04:16.000Z","dependencies_parsed_at":"2022-09-18T04:21:37.685Z","dependency_job_id":null,"html_url":"https://github.com/webkom/readme-as-a-function","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/webkom%2Freadme-as-a-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkom%2Freadme-as-a-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkom%2Freadme-as-a-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkom%2Freadme-as-a-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webkom","download_url":"https://codeload.github.com/webkom/readme-as-a-function/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249131019,"owners_count":21217657,"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","faas","function","golang","graphql","serverless"],"created_at":"2025-03-12T10:18:21.663Z","updated_at":"2025-04-15T18:42:04.690Z","avatar_url":"https://github.com/webkom.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# readme-as-a-function\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/webkom/readme-as-a-function)](https://goreportcard.com/report/github.com/webkom/readme-as-a-function) [![Build Status](https://ci.webkom.dev/api/badges/webkom/readme-as-a-function/status.svg)](https://ci.webkom.dev/webkom/readme-as-a-function)\n\nGraphql api as a function, runs in [openfaas](https://www.openfaas.com/).\n\nAllows you to fetch the `n` last readmes. Also possible to filter based on year and issue number.\n\n## Storage format\n\nThe readmes are stored in a bucket in the following format:\n\n```sh\n# The bucket has two top-level directories:\n/images/\n# and\n/pdf/\n\n# Both these folders follow the schema \u003cyear\u003e/\u003cyear\u003e-\u003cedition\u003e.\u003cext\u003e\n# So we have the following folders:\n/pdf/1994/\n/pdf/1995/\n#...\n/pdf/2020/\n# The same goes for images\n/images/2020/\n\n# In all the year folders, the pdfs and images are stored:\n/pdf/1994/1994-01.pdf\n/pdf/1994/1994-02.pdf\n# ...and so on\n# Again images must follow the same schema\n/images/1994/1994-01.jpg\n```\n\n\u003e If the bucket does not follow this schema, the api will not give the correct results!\n\nNote also that we do not check the file extension. It's assumed that all files in `/pdf/` are .pdf.\nThe api creates a link based on the file, so any files will resolve.\nFor images, any valid file format works, so jpg, png, gif, whatever.\n\nRunning on https://readme-as-a-function.abakus.no\n\n## To run locally\n\n```bash\n$ # Simple usage\n$ go run main.go \u003c\u003c\u003c  '{\"query\":\"{latestReadme{ title }}\"}' | jq\n$ # As webserver at http://localhost:8000\n$ go run pkg/webserver/main.go\n\n```\n\n### API schema\n\n```graphql\nschema {\n  query: Query\n}\ntype Query {\n  # Get a list of readmes\n  readmeUtgaver(\n    # Filter by year\n    year: Int\n    # filter by issue number, 1 to 6\n    utgave: Int\n    # Get the first _n_ issues/utgaver\n    first: Int\n  ): [ReadmeUtgave!]!\n  # Get the latest readme\n  latestReadme: ReadmeUtgave\n}\ntype ReadmeUtgave {\n  title: String!\n  image: String!\n  pdf: String!\n  year: Int!\n  utgave: Int!\n}\n```\n\n### Testing\n\n```bash\n$ go test -v ./...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebkom%2Freadme-as-a-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebkom%2Freadme-as-a-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebkom%2Freadme-as-a-function/lists"}