Examples | CREATESONLINE

Examples

# Copy-ready snippets

Drop these into your app to prove out ERP flows, commerce APIs, or data copilots.

### Simple API endpoint

async def get_users(request): return {"users": ["Alice", "Bob", "Charlie"]} urlpatterns.append(path('/api/users', get_users))

### POST handler

async def create_user(request): data = await request.json() return {"created": data, "id": 123} urlpatterns.append(path('/api/users', create_user, methods=['POST']))

### Serve a template

async def about_page(request): from createsonline import render_template html = render_template('about.html') from createsonline.server import InternalHTMLResponse return InternalHTMLResponse(html) urlpatterns.append(path('/about', about_page))

Home Inspect live docs