Skip to main content

API Reference

Complete reference for the Axiom Genesis API.

Core API

AxiomGenesis Class

The main class for creating and managing applications.

Constructor

const app = new AxiomGenesis(options);

Methods

  • app.get(path, handler) - Register a GET route
  • app.post(path, handler) - Register a POST route
  • app.put(path, handler) - Register a PUT route
  • app.delete(path, handler) - Register a DELETE route
  • app.use(middleware) - Register middleware
  • app.listen(port, callback) - Start the server

Server Class

Manages the HTTP server.

const server = new Server(app);
server.listen(3000);
server.stop();

Request/Response Objects

Request

  • req.method - HTTP method (GET, POST, etc.)
  • req.path - Request path
  • req.params - URL parameters
  • req.query - Query string parameters
  • req.body - Request body
  • req.headers - HTTP headers

Response

  • res.json(data) - Send JSON response
  • res.text(text) - Send text response
  • res.html(html) - Send HTML response
  • res.status(code) - Set status code
  • res.header(key, value) - Set header
  • res.error(error) - Send error response

Middleware

Standard middleware interface:

(req, res, next) => {
// Process request
next(); // Call next middleware
};

Utilities

  • Utils.encryption - Encryption utilities
  • Utils.validation - Validation utilities
  • Utils.logging - Logging utilities

See Also