No description
- Ruby 54.5%
- CSS 20.9%
- HTML 12.1%
- JavaScript 10.2%
- Dockerfile 2.3%
| app.rb | ||
| Containerfile | ||
| Gemfile | ||
| Gemfile.lock | ||
| README.md | ||
| TLDR.md | ||
No as a Service (NaaS)
A simple Sinatra-based web service that provides creative "no" responses in both HTML and JSON formats.
Features
- Dual Format Support: Serves both HTML (for browsers) and JSON (for APIs)
- Random Responses: Returns a random "no" response from a curated list
- Modern Styling: Beautiful glassmorphism design for the HTML interface
- Health Checks: Built-in health check endpoint for monitoring
- Containerized: Ready for deployment with Podman/Docker
API Endpoints
GET /- Returns a random "no" (HTML by default, JSON with Accept header)GET /api/no- Explicit JSON endpoint with additional metadataGET /health- Health check endpointGET /*- Catch-all that returns "no" for any other path
Content Negotiation
The root endpoint (/) supports content negotiation:
- Browser requests get HTML
- Requests with
Accept: application/jsonget JSON
Usage Examples
HTML (Browser)
curl http://localhost:4567/
JSON
# Using Accept header
curl -H "Accept: application/json" http://localhost:4567/
# Using explicit API endpoint
curl http://localhost:4567/api/no
Sample JSON Response
{
"answer": "Absolutely not",
"timestamp": "2025-06-06T12:00:00Z",
"service": "No as a Service",
"version": "1.0.0"
}
Local Development
Prerequisites
- Ruby 3.2+
- Bundler
Setup
# Install dependencies
bundle install
# Run the application
ruby app.rb
# Or use rerun for auto-reload during development
bundle exec rerun ruby app.rb
The application will be available at http://localhost:4567
Container Deployment
Build with Podman
podman build -t naas .
Run with Podman
# Basic run
podman run -p 4567:4567 naas
# Run in background with restart policy
podman run -d --name naas-service -p 4567:4567 --restart=always naas
# Run with custom port
podman run -p 8080:4567 -e PORT=4567 naas
Docker Commands
The same commands work with Docker by replacing podman with docker.
Environment Variables
PORT- Port to bind to (default: 4567)
Health Monitoring
The service includes a health check endpoint at /health that returns:
{
"status": "healthy",
"timestamp": "2025-06-06T12:00:00Z"
}
File Structure
.
├── app.rb # Main Sinatra application
├── Gemfile # Ruby dependencies
├── Containerfile # Container build instructions
└── README.md # This file
License
This project is released under the MIT License. Feel free to use it for your negative response needs!