Routing APIs through Query-Parameters

In Membrane, you can direct incoming requests to your API using the expression test property. In this case the expression will extract a parameter audience to decide which content should be returned.

Configuration

<api port="2000" test="params.audience matches 'customer'">
<template>
This is customer content.
</template>
<return />
</api>

<api port="2000">
<template>
This is content that everyone else will get.
</template>
<return />
</api>
<api port="2000" test="params.audience matches 'customer'">
    <template>
        This is customer content.
    </template>
    <return />
</api>

<api port="2000">
    <template>
        This is content that everyone else will get.
    </template>
    <return />
</api>