Skip to content

Compare web content using HTMLRewriter and Elysia.

License

Notifications You must be signed in to change notification settings

estavadormir/fartone

Repository files navigation

Fartone

A fast, Bun-powered API for checking and comparing web content using HTMLRewriter and Elysia.

Features

  • Check for presence of HTML elements
  • Compare specific content within elements
  • Built with Bun's native HTMLRewriter for performance
  • OpenAPI documentation with Swagger generated by Elysia
  • Error handling and validation
  • Type-safe with TypeScript

Installation

# Install dependencies
bun install

Usage

Start the server in development mode:

bun run dev

Server runs at http://localhost:3000 for now.

Endpoints

Check Element Presence

POST /check
{
  "url": "https://example.com",
  "selector": "H1"
}

Compare Content

POST /compare
{
  "url": "https://example.com",
  "selector": "H2",
  "expectedContent": "Expected text"
}

Response Codes

  • 200: Success
  • 400: Invalid URL
  • 404: Element/Content not found
  • 500: Internal server error

Documentation

OpenAPI documentation available at /swagger

Technologies

  • Bun
  • Elysia
  • HTMLRewriter (Bun's native HTML parser)
  • TypeScript

TODO

  • Add rate limiting
  • Implement authentication
  • Add metrics collection
  • Add request logging
  • Add tests
  • Separate classes into separate files
  • SEparate utils into separate files

About

Compare web content using HTMLRewriter and Elysia.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published