Expressify

A lightweight Express.js-inspired web framework for Python

app.py
from expressify import expressify

# Create a new app
app = expressify()

@app.get('/')
def home(req, res):
    res.send('Hello, World!')

# Start the server
if __name__ == '__main__':
    app.listen(port=3000, hostname='127.0.0.1')  # Default port and hostname
Features

Powerful Yet Simple

Everything you need to build modern web applications and APIs in Python, with an intuitive Express.js-like API.

Intuitive Routing

Define routes using decorators with support for path parameters, query strings, and multiple HTTP methods.

Middleware Support

Apply middleware globally, to specific routes, or grouped routes. Chain multiple middleware functions effortlessly.

Template Rendering

Seamless integration with Jinja2 templates for dynamic content rendering with context data.

Static File Serving

Easily serve static files like CSS, JavaScript, and images with built-in middleware.

Error Handling

Comprehensive error handling with custom error pages and middleware for catching exceptions.

Sessions & Cookies

Built-in support for managing user sessions, cookies, and stateful interactions.

Development Server

Built-in development server with hot reloading for efficient and streamlined development workflow.

Code

Simple and Expressive

Create web apps in minutes with Expressify's intuitive API.

Create a web app in minutes

Expressify's intuitive API makes it easy to create web applications and APIs with minimal code. Similar to Express.js, but with Python's elegance.

  • Decorator-based routing

    Clean and intuitive route definitions using Python decorators

  • Clean request and response handling

    Expressify handles request and response handling with ease

  • Full support for path parameters and query strings

    Expressify supports all types of routes and query parameters

  • JSON responses with automatic content-type headers

    Expressify automatically sets the content-type header for JSON responses

  • Development Server with Hot Reloading

    Boost productivity with automatic server restarts on code changes

app.py
from expressify import expressify

# Create a new app
app = expressify()

@app.get('/')
def home(req, res):
    res.send('Hello, World!')

@app.get('/api/users')
def get_users(req, res):
    # Query parameter: /api/users?limit=10
    limit = int(req.query.get('limit', 10))
    users = [{'id': i, 'name': f'User {i}'} for i in range(limit)]
    res.json(users)

@app.get('/users/:id')
def get_user(req, res):
    # Path parameter: /users/42
    user_id = req.params.get('id')
    # Find user (simulated)
    user = {'id': user_id, 'name': f'User {user_id}'}
    res.json(user)

@app.post('/api/users')
def create_user(req, res):
    # Access JSON body data
    new_user = req.body
    # Create user (simulated)
    new_user['id'] = 42
    res.status(201).json(new_user)

# Start the server
if __name__ == '__main__':
    app.listen(port=3000, hostname='127.0.0.1')  # Default port and hostname
Copied to clipboard!

Explore Examples

Ready to Get Started?

Start building your web applications with Expressify today.

Documentation