https://github.com/compwright/express-sns-validator
ExpressJS middleware for verifying Amazon SNS notifications using sns-validator
https://github.com/compwright/express-sns-validator
expressjs-middleware
Last synced: about 1 month ago
JSON representation
ExpressJS middleware for verifying Amazon SNS notifications using sns-validator
- Host: GitHub
- URL: https://github.com/compwright/express-sns-validator
- Owner: compwright
- License: mit
- Created: 2017-10-27T13:46:56.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-02-22T16:55:07.000Z (about 1 year ago)
- Last Synced: 2025-04-11T22:39:00.790Z (12 months ago)
- Topics: expressjs-middleware
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/express-sns-validator
- Size: 586 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# express-sns-validator
[](https://travis-ci.org/compwright/express-sns-validator)
[](https://david-dm.org/compwright/express-sns-validator)
[](https://www.npmjs.com/package/express-sns-validator)
[](https://github.com/sponsors/compwright)
ExpressJS middleware for verifying Amazon SNS notifications using [sns-validator](https://www.npmjs.com/package/sns-validator) (no dependency on the AWS SDK).
## Requirements
* NodeJS 10+
* ExpressJS 4+
* body-parser 1.4+
## Installation
```bash
npm install --save express-sns-validator
```
## Usage
Add to the route handler you will use to subscribe to Amazon SNS notifications. If the request does not validate, an HTTP 400 will be returned.
> Note: you need [body-parser](https://npmjs.com/package/body-parser) to parse the JSON body from SNS.
```javascript
const express = require('express')
const bodyParser = require('body-parser')
const snsMiddleware = require('express-sns-validator')
const app = express()
app.use(bodyParser.json()) // required for express-sns-validator to work properly
app.post('/notifications/sns', snsMiddleware(), (req, res) => {
// do stuff with req.body
});
```
## License
MIT License