It is a repository for Directus Headless CMS (https://directus.io/)
- Docker and docker-compose are the pre-requisites.
- Clone the repository
- Copy
_env
to.env
- Edit
.env
file and replace the values inDIR_KEY
,DIR_SECRET
,PGADMIN_PASSWORD
,DB_PASSWORD
,ADMIN_PASSWORD
parameters by running for each a separate bash commandopenssl rand -base64 16
- Update the
docker-compose.yml
file, image name (currentlydirectus/directus:latest
) to the particular version if required - Start with the command
./start.sh
(respectively stop by./stop.sh
)
REST API can be reached by the URL (for collections):
http://localhost:8055/items/customers/
where
- localhost:8055
- a host and a port (see DIR_PORT
)
- customers
- a collection name
GQL is a powerful query language for the GraphQL API endpoint:
http://localhost:8055/graphql?access_token=mysecretpass
where
- localhost:8055
- a host and a port (see DIR_PORT
)
- mysecretpass
- personal user token, defined by the admin in a user profile
Get all records from the collection customers
where field rec_id
is equal to "3453676575676":
query {
customers (filter: { rec_id: { _eq: "3453676575676" } })
{
rec_id
kyc_level
}
}
search the collection customers
for any field matching the value "435":
query {
customers (search: "435")
{
rec_id
kyc_level
}
}
get the record from the collection customers
where the id field is "1":
query {
customers_by_id (id: 1)
{
rec_id
kyc_level
}
}
get the record from the collection customers
where the id field is "1" and show branch name where the customer is registered:
query {
customers_by_id (id: 1)
{
id
rec_id
kyc_level
branch_id {branch_name}
}
}