├── .gitignore ├── readme.md ├── package.json ├── index.js └── public ├── index.html └── js └── main.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | .DS_Store -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Website Accessibility Tester 2 | 3 | Web app to find website accessibility issues using [Pa11y](https://github.com/pa11y/pa11y) 4 | 5 | ## Usage 6 | 7 | Install dependencies 8 | 9 | ```bash 10 | npm install 11 | ``` 12 | 13 | Run 14 | 15 | ```bash 16 | npm start 17 | ``` 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "website-accessibility-tester", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1", 14 | "pa11y": "^6.0.1" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const pa11y = require('pa11y') 3 | const PORT = process.env.PORT || 5000 4 | 5 | const app = express() 6 | 7 | app.use(express.static('public')) 8 | 9 | app.get('/api/test', async (req, res) => { 10 | if (!req.query.url) { 11 | res.status(400).json({ error: 'url is required' }) 12 | } else { 13 | const results = await pa11y(req.query.url) 14 | res.status(200).json(results) 15 | } 16 | }) 17 | 18 | app.listen(PORT, () => console.log(`Server started on port ${PORT}`)) 19 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 13 |${issues.length} issues found !
79 | ` 80 | issues.forEach((issue) => { 81 | const output = ` 82 |87 | ${escapeHTML(issue.context)} 88 |
89 | 90 |91 | CODE: ${issue.code} 92 |
93 |