Skip to content

niraj2477/routex

Repository files navigation

RouteX Logo

Python 3.11+ License: AGPL3.0

Rest API compatible routes for Frappe

RouteX is a Frappe app that enhances API routing by introducing RESTful endpoints alongside Frappe’s default dotted path approach. It provides a more intuitive and flexible way to define and manage API routes in Frappe applications.

Quick StartExamplesSupport

✨ Features

RestAPI compatible

  • Fully supports RESTful principles, making it easy to integrate with external services.

  • Supports slashed path-based routing (e.g., /api/app-name/) instead of Frappe’s dotted path convention for cleaner and more intuitive URLs.

Grouped Routes

  • Organize multiple related API endpoints under a single namespace.
  • Helps maintain cleaner, more structured API management.

Custom route names

  • Allows defining human-readable and meaningful route names.
  • Enhances debugging and logging by providing easily identifiable route identifiers.

🛠️ Requirements

  • Python 3.11 or higher
  • Frappe

🚀 Quick Start

# Install RouteX
bench get-app https://github.com/niraj2477/routex
bench install-app routex

📚 Examples

Usage

# Use routex_whitelist function to add your route, In this example we are are defineing a route name "foo" that will be accessible via /api/[app-name]/foo
@routex_whitelist("/foo")
def foo():
    return "bar"

GROUPED ROUTE

# For grouping the routes we have parameter which can be passed, which will group the routes. eg. /api/[app-name]/group/foo
@routex_whitelist("/foo",group="/group")
def foo():
    return "bar"

routex_whitelist does supports all the params supported by the whitelist, since using routex method will automatically registers the api with frappe.whitelist.

🤝 Support

👏 authors

@elifvish @niraj2477 @dhsathiya

About

Rest API compatible routes for Frappe

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages