Menu
Menu Sheet Overlay
Search
Search Sheet

Routing

Routing Architecture

    Routing for Mobify AMP uses standard Express routing.

    Routes are defined in amp/app/main.js. You can define routes using regular expressions to match to static assets, or containers (page templates).

    From our example project:

    app.get('/favicon.ico', (req, res) => res.redirect(staticURL('ico/favicon.ico')))
    app.get('/robots.txt', (req, res) => res.redirect(staticURL('robots.txt')))
    app.get('/s/2017refresh/womens', handlePage(ProductList))
    app.get('/s/2017refresh/mens', handlePage(ProductList))
    app.get('/potions.html', handlePage(ProductList))
    app.get('/books.html', handlePage(ProductList))
    app.get('/ingredients.html', handlePage(ProductList))
    app.get('/supplies.html', handlePage(ProductList))
    app.get('/new-arrivals.html', handlePage(ProductList))
    app.get('/charms.html', handlePage(ProductList))
    app.get('/checkout/cart/configure/id/*/product_id/*/', handlePage(ProductDetails))
    app.get('*.html', handlePage(ProductDetails))