{"id":22831109,"url":"https://github.com/dudemelo/sails-hook-flash","last_synced_at":"2025-06-10T09:33:29.450Z","repository":{"id":28133732,"uuid":"31633080","full_name":"dudemelo/sails-hook-flash","owner":"dudemelo","description":"Flash message for Sails applications","archived":false,"fork":false,"pushed_at":"2019-12-24T08:24:57.000Z","size":19,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-26T04:13:22.610Z","etag":null,"topics":["flash-messages","javascript","nodejs","sails"],"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/dudemelo.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":"2015-03-04T02:13:15.000Z","updated_at":"2019-12-24T08:24:56.000Z","dependencies_parsed_at":"2022-09-03T15:01:52.196Z","dependency_job_id":null,"html_url":"https://github.com/dudemelo/sails-hook-flash","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dudemelo%2Fsails-hook-flash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dudemelo%2Fsails-hook-flash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dudemelo%2Fsails-hook-flash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dudemelo%2Fsails-hook-flash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dudemelo","download_url":"https://codeload.github.com/dudemelo/sails-hook-flash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dudemelo%2Fsails-hook-flash/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259048354,"owners_count":22797717,"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":["flash-messages","javascript","nodejs","sails"],"created_at":"2024-12-12T20:18:43.938Z","updated_at":"2025-06-10T09:33:29.420Z","avatar_url":"https://github.com/dudemelo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sails-hook-flash\n\n[![NPM Version][npm-version]][npm-url]\n[![NPM Download][npm-download]][npm-url]\n[![Travis CI][travis-ci]][travis-url]\n[![Coverage Status][coveralls]][coveralls-url]\n\nThe simplest way to use **flash messages** in your [Sails](http://sailsjs.org)\napplication. This is useful when you want to redirect and have a special message\nshown on the next page.\n\n## Installation\n\n```\nnpm install sails-hook-flash\n```\n*Use `--save` to add in your package.json.*\n\n## Example\n\nAdding a new flash message:\n```js\n// api/controllers/SampleController.js\nlogin: function (request, response) {\n  request.addFlash('success', 'A success message.');\n  return response.redirect('/sample/success');\n}\n```\n\nRendering your flash message:\n```js\n// views/sample/success.ejs\n\u003c% flash.get('success').forEach(function (message) { %\u003e\n    \u003cdiv style=\"color:green;\"\u003e\n      \u003c%= message %\u003e\n    \u003c/div\u003e\n\u003c% }) %\u003e\n```\n*NOTE: The EJS view engine is used in this sample, but you're not limited to it.*\n\n## Usage\n\n#### Controller layer\n* `request.addFlash(type, message)` - Stores a new message\n* `request.getFlash(type)`          - Returns all messages from a type\n* `request.hasFlash(type)`          - Checks if a message type was stored\n\n#### View layer\n* `flash.all()`     - Returns all messages\n* `flash.get(type)` - Returns all messages from a type\n* `flash.has(type)` - Checks if a message type was stored\n\n[npm-url]: http://npmjs.org/package/sails-hook-flash\n[travis-url]: http://travis-ci.org/dudemelo/sails-hook-flash\n[coveralls-url]: https://coveralls.io/github/dudemelo/sails-hook-flash?branch=master\n\n[npm-version]: https://img.shields.io/npm/v/sails-hook-flash.svg?style=flat-square\n[npm-download]: https://img.shields.io/npm/dm/sails-hook-flash.svg?style=flat-square\n[travis-ci]: https://img.shields.io/travis/dudemelo/sails-hook-flash.svg?style=flat-square\n[coveralls]: https://img.shields.io/coveralls/dudemelo/sails-hook-flash.svg?style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdudemelo%2Fsails-hook-flash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdudemelo%2Fsails-hook-flash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdudemelo%2Fsails-hook-flash/lists"}