always404 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.txt +21 -0
- package/README.md +50 -0
- package/index.js +8 -0
- package/package.json +19 -0
package/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Vicktor Moberg
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
# always-404
|
3
|
+
|
4
|
+
A simple Express middleware that ensures every route responds with a 404 status and a "Page Not Found" message. Perfect for pranks, debugging, or just being extra unhelpful. 😄
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Install the package via npm:
|
9
|
+
|
10
|
+
```bash
|
11
|
+
npm install always-404
|
12
|
+
```
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
Integrate the middleware into your Express application:
|
17
|
+
|
18
|
+
```javascript
|
19
|
+
const express = require('express');
|
20
|
+
const always404 = require('always-404');
|
21
|
+
|
22
|
+
const app = express();
|
23
|
+
|
24
|
+
app.use(always404());
|
25
|
+
|
26
|
+
app.listen(3000, () => {
|
27
|
+
console.log('Server running on http://localhost:3000');
|
28
|
+
});
|
29
|
+
```
|
30
|
+
|
31
|
+
Now, every route in your application will respond with:
|
32
|
+
|
33
|
+
- HTTP status: `404`
|
34
|
+
- Message: `404 - Page Not Found!`
|
35
|
+
|
36
|
+
## Features
|
37
|
+
|
38
|
+
- **Guaranteed 404:** No route will ever work. Ever.
|
39
|
+
- **Minimal setup:** Just plug it into your Express app.
|
40
|
+
- **Great for pranks:** Make your friend's website unresponsive for April Fools' Day!
|
41
|
+
|
42
|
+
## API
|
43
|
+
|
44
|
+
### `always404()`
|
45
|
+
|
46
|
+
Returns an Express middleware function that intercepts all requests and responds with a 404 status code and a default message.
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
|
package/index.js
ADDED
package/package.json
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"name": "always404",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "Always produces a 404",
|
5
|
+
"author": "Vicktor Moberg",
|
6
|
+
"homepage": "https://github.com/VickM12/always404",
|
7
|
+
"keywords": ["404", "status", "express", "string", "req", "res", "request", "response", "error", "http"],
|
8
|
+
"license": "MIT",
|
9
|
+
"scripts": {
|
10
|
+
"test": "mocha"
|
11
|
+
},
|
12
|
+
"files": [
|
13
|
+
"index.js"
|
14
|
+
],
|
15
|
+
"main": "index.js",
|
16
|
+
"engines": {
|
17
|
+
"node": ">=10.0.0"
|
18
|
+
}
|
19
|
+
}
|