spin-up-ping
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "spin-up-ping", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -10,7 +10,5 @@ "main": "dist/index.js", | ||
], | ||
"scripts": { | ||
"test": "jest", | ||
"start": "node dist/index.js", | ||
"dev": "ts-node-dev --respawn --transpile-only src/index.ts", | ||
"build": "tsc" | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Muhsin-42/spin-up-ping.git" | ||
}, | ||
@@ -42,7 +40,13 @@ "keywords": [ | ||
], | ||
"author": "Muhsin Abdul Nissar", | ||
"author": { | ||
"name": "Muhsin Abdul Nissar", | ||
"email": "muhsinofficial21@gmail.com", | ||
"url": "https://github.com/Muhsin-42" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Muhsin-42/spin-up-ping/issues" | ||
}, | ||
"homepage": "https://github.com/Muhsin-42/spin-up-ping#readme", | ||
"license": "ISC", | ||
"dependencies": { | ||
"dotenv": "^16.4.5", | ||
"express": "^4.21.1", | ||
"axios": "^1.6.0", | ||
@@ -52,11 +56,17 @@ "debug": "^4.3.4" | ||
"devDependencies": { | ||
"@types/debug": "^4.1.12", | ||
"@types/express": "^5.0.0", | ||
"@types/jest": "^29.5.11", | ||
"@types/node": "^22.9.0", | ||
"ts-node-dev": "^2.0.0", | ||
"@types/debug": "^4.1.12", | ||
"@types/jest": "^29.5.11", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.1", | ||
"ts-node-dev": "^2.0.0", | ||
"typescript": "^5.3.0" | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"start": "node dist/index.js", | ||
"dev": "ts-node-dev --respawn --transpile-only src/index.ts", | ||
"build": "tsc" | ||
} | ||
} | ||
} |
121
README.md
@@ -1,25 +0,54 @@ | ||
# Server Ping Keeper | ||
# spin-up-ping 🚀 | ||
Keep your server alive by sending periodic pings. Perfect for preventing free-tier servers from spinning down due to inactivity. | ||
Keep your server awake and prevent it from spinning down due to inactivity! Perfect for free-tier hosting platforms like Render, Heroku, etc. | ||
## Installation | ||
[![NPM Version](https://img.shields.io/npm/v/spin-up-ping)](https://www.npmjs.com/package/spin-up-ping) | ||
[![GitHub Issues](https://img.shields.io/github/issues/Muhsin-42/spin-up-ping)](https://github.com/Muhsin-42/spin-up-ping/issues) | ||
[![License](https://img.shields.io/npm/l/spin-up-ping)](https://github.com/Muhsin-42/spin-up-ping/blob/main/LICENSE) | ||
<!-- [![Downloads](https://img.shields.io/npm/dt/spin-up-ping)](https://www.npmjs.com/package/spin-up-ping) --> | ||
<!-- [![GitHub Stars](https://img.shields.io/github/stars/Muhsin-42/spin-up-ping)](https://github.com/Muhsin-42/spin-up-ping/stargazers) --> | ||
## Why spin-up-ping? 🤔 | ||
Free-tier hosting services often spin down your server after a period of inactivity (usually 15-30 minutes). This can lead to slow response times when the server needs to spin up again. `spin-up-ping` solves this by sending periodic pings to keep your server alive. | ||
## Features ✨ | ||
- 🔄 Configurable ping intervals (minimum 5 minutes) | ||
- 📊 Success and error callbacks for monitoring | ||
- 🛡️ Built-in abuse prevention | ||
- 🪵 Debug logging support | ||
- 💪 Written in TypeScript with full type support | ||
- 🎯 Zero dependencies (except axios for HTTP requests) | ||
## Installation 📦 | ||
```bash | ||
npm install server-ping-keeper | ||
# or | ||
yarn add server-ping-keeper | ||
# or | ||
pnpm add server-ping-keeper | ||
# Using npm | ||
npm install spin-up-ping | ||
# Using yarn | ||
yarn add spin-up-ping | ||
# Using pnpm | ||
pnpm add spin-up-ping | ||
``` | ||
## Usage | ||
## Usage 💻 | ||
```typescript | ||
import {ServerPingKeeper} from "server-ping-keeper"; | ||
import {ServerPingKeeper} from "spin-up-ping"; | ||
const keeper = new ServerPingKeeper({ | ||
url: "https://your-server.com", | ||
intervalMinutes: 10, // minimum 10 minutes | ||
onSuccess: (response) => console.log("Ping successful:", response), | ||
onError: (error) => console.error("Ping failed:", error), | ||
url: "https://your-server.com", // Your server URL | ||
intervalMinutes: 5, // Minimum 5 minutes | ||
onSuccess: (response) => { | ||
// Optional success callback | ||
console.log("Ping successful:", response); | ||
}, | ||
onError: (error) => { | ||
// Optional error callback | ||
console.error("Ping failed:", error); | ||
}, | ||
}); | ||
@@ -34,21 +63,55 @@ | ||
## Features | ||
## API Reference 📚 | ||
- TypeScript support with full type definitions | ||
- Minimum interval enforcement to prevent abuse | ||
- Optional success and error callbacks | ||
- Debug logging support | ||
- Automatic retry on failure | ||
### ServerPingKeeper | ||
## Options | ||
#### Constructor Options | ||
| Option | Type | Description | | ||
| --------------- | -------- | ---------------------------- | | ||
| url | string | The URL to ping | | ||
| intervalMinutes | number | Time between pings (min: 10) | | ||
| onSuccess | function | Optional success callback | | ||
| onError | function | Optional error callback | | ||
```typescript | ||
interface PingKeeperOptions { | ||
url: string; // URL to ping | ||
intervalMinutes: number; // Interval between pings (min: 5) | ||
onSuccess?: (response: any) => void; // Success callback | ||
onError?: (error: Error) => void; // Error callback | ||
} | ||
``` | ||
## License | ||
#### Methods | ||
MIT | ||
- `start()`: Start the ping service | ||
- `stop()`: Stop the ping service | ||
## Common Use Cases 🎯 | ||
1. **Free Hosting Services** | ||
- Prevent Render, Railway.app etc from sleeping | ||
2. **Development & Testing** | ||
- Keep development servers active | ||
- Monitor server health | ||
## Best Practices 💡 | ||
1. Set interval slightly lower than your hosting platform's timeout | ||
2. Implement error handling for network issues | ||
3. Enable debug logging during development | ||
4. Use environment variables for server URLs | ||
## Contributing 🤝 | ||
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change. | ||
1. Fork the repository | ||
2. Create your feature branch (`git checkout -b feature/AmazingFeature`) | ||
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) | ||
4. Push to the branch (`git push origin feature/AmazingFeature`) | ||
5. Open a Pull Request | ||
## License 📄 | ||
ISC © [Muhsin Abdul Nissar](https://github.com/Muhsin-42) | ||
## Support ⭐ | ||
If you found this package helpful, please consider giving it a star on GitHub! |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
9203
2
0
0
117
0
- Removeddotenv@^16.4.5
- Removedexpress@^4.21.1
- Removedaccepts@1.3.8(transitive)
- Removedarray-flatten@1.1.1(transitive)
- Removedbody-parser@1.20.3(transitive)
- Removedbytes@3.1.2(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedcontent-disposition@0.5.4(transitive)
- Removedcontent-type@1.0.5(transitive)
- Removedcookie@0.7.1(transitive)
- Removedcookie-signature@1.0.6(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddepd@2.0.0(transitive)
- Removeddestroy@1.2.0(transitive)
- Removeddotenv@16.4.5(transitive)
- Removedee-first@1.1.1(transitive)
- Removedencodeurl@1.0.22.0.0(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedescape-html@1.0.3(transitive)
- Removedetag@1.8.1(transitive)
- Removedexpress@4.21.1(transitive)
- Removedfinalhandler@1.3.1(transitive)
- Removedforwarded@0.2.0(transitive)
- Removedfresh@0.5.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhttp-errors@2.0.0(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinherits@2.0.4(transitive)
- Removedipaddr.js@1.9.1(transitive)
- Removedmedia-typer@0.3.0(transitive)
- Removedmerge-descriptors@1.0.3(transitive)
- Removedmethods@1.1.2(transitive)
- Removedmime@1.6.0(transitive)
- Removedms@2.0.0(transitive)
- Removednegotiator@0.6.3(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedon-finished@2.4.1(transitive)
- Removedparseurl@1.3.3(transitive)
- Removedpath-to-regexp@0.1.10(transitive)
- Removedproxy-addr@2.0.7(transitive)
- Removedqs@6.13.0(transitive)
- Removedrange-parser@1.2.1(transitive)
- Removedraw-body@2.5.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsend@0.19.0(transitive)
- Removedserve-static@1.16.2(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedsetprototypeof@1.2.0(transitive)
- Removedside-channel@1.0.6(transitive)
- Removedstatuses@2.0.1(transitive)
- Removedtoidentifier@1.0.1(transitive)
- Removedtype-is@1.6.18(transitive)
- Removedunpipe@1.0.0(transitive)
- Removedutils-merge@1.0.1(transitive)
- Removedvary@1.1.2(transitive)