{"id":19138365,"url":"https://github.com/rickharrison/koa-flash","last_synced_at":"2025-05-06T20:46:47.987Z","repository":{"id":15222974,"uuid":"17951563","full_name":"rickharrison/koa-flash","owner":"rickharrison","description":"Flash messages for your koa application.","archived":false,"fork":false,"pushed_at":"2021-11-02T10:54:13.000Z","size":240,"stargazers_count":39,"open_issues_count":5,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T02:18:39.598Z","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/rickharrison.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":"2014-03-20T17:22:05.000Z","updated_at":"2020-04-22T16:26:19.000Z","dependencies_parsed_at":"2022-09-10T07:40:07.857Z","dependency_job_id":null,"html_url":"https://github.com/rickharrison/koa-flash","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/rickharrison%2Fkoa-flash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickharrison%2Fkoa-flash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickharrison%2Fkoa-flash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickharrison%2Fkoa-flash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rickharrison","download_url":"https://codeload.github.com/rickharrison/koa-flash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252769134,"owners_count":21801373,"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-09T06:42:45.235Z","updated_at":"2025-05-06T20:46:47.950Z","avatar_url":"https://github.com/rickharrison.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#koa-flash\n\nFlash messages for your [koa](https://github.com/koajs/koa) application.\n\n[![Build Status](https://travis-ci.org/rickharrison/koa-flash.svg?branch=master)](https://travis-ci.org/rickharrison/koa-flash)\n\n## Installation\n\n```js\n$ npm install koa-flash\n```\n\nkoa-flash also depends on [koa-session](https://github.com/koajs/session). You must add koa-session as a middleware prior to adding koa-flash as seen in the example:\n\n## Example\n\n```js\nvar koa = require('koa')\n  , session = require('koa-session')\n  , flash = require('koa-flash');\n\nvar app = koa();\n\napp.keys = ['foo'];\napp.use(session());\napp.use(flash());\n\napp.use(function *() {\n  if (this.method === 'POST') {\n    this.flash = { error: 'This is a flash error message.' };\n  } else if (this.method === 'GET') {\n    this.body = this.flash.error || 'No flash data.';\n  }\n});\n\napp.listen(3000);\n```\n\n## Semantics\n\nFlash data when set will be saved to the user's session for exactly one more request. You can save any javascript object into `this.flash` (Object, Number, String, etc.). A common use case is to save an error message from a `POST` request when redirecting to a `GET` request to display the form again.\n\n## Options\n\nFlash data is saved into `this.session['koa-flash']` by default. You can change this by passing in a `key` option.\n\n```js\napp.use(flash({ key: 'foo' }));\n```\n\nAlso, you can set `defaultValue` instead of `{}`.\n\n```js\napp.use(flash({ defaultValue: 'bar' }));\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickharrison%2Fkoa-flash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickharrison%2Fkoa-flash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickharrison%2Fkoa-flash/lists"}