Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spin-up-ping

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spin-up-ping - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

36

package.json
{
"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"
}
}
}

@@ -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!
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc