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 routeapp.post(path, handler)- Register a POST routeapp.put(path, handler)- Register a PUT routeapp.delete(path, handler)- Register a DELETE routeapp.use(middleware)- Register middlewareapp.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 pathreq.params- URL parametersreq.query- Query string parametersreq.body- Request bodyreq.headers- HTTP headers
Response
res.json(data)- Send JSON responseres.text(text)- Send text responseres.html(html)- Send HTML responseres.status(code)- Set status coderes.header(key, value)- Set headerres.error(error)- Send error response
Middleware
Standard middleware interface:
(req, res, next) => {
// Process request
next(); // Call next middleware
};
Utilities
Utils.encryption- Encryption utilitiesUtils.validation- Validation utilitiesUtils.logging- Logging utilities