Files
acms/docs/get-started-cli.md

1.8 KiB

Get started with the CLI

Create a new project

Create a new folder for your project, my-project. Change into it, and set AMCS_CONTENT to the folder that should store your content.

mkdir -p my-project
cd my-project
export ACMS_CONTENT=$PWD/content

Create a restaurant collection type

acms collection add restaurant <<'EOF'
{
  "name": "Biscotte Restaurant",
  "description": "Welcome to Biscotte restaurant! Restaurant Biscotte offers a cuisine based on fresh, quality products, often local, organic when possible, and always produced by passionate producers."
}
EOF

Create a category collection type

acms collection add category <<'EOF'
{
  "name": "French Food",
  "restaurant": "1.json"
}
EOF
acms collection add category <<'EOF'
{
  "name": "Brunch",
  "restaurant": "1.json"
}
EOF

Query the API

curl 'http://localhost:8081' --data '
  SELECT
    {
      name: restaurant.name,
      description: restaurant.description,
      category: {
        category: category.name
      }
    }
  FROM
    restaurant
  LEFT JOIN
    category
  ON
    category.restaurant == restaurant.$fileName
' | jq .
[
  {
    "category": {
      "category": "French Food"
    },
    "description": "Welcome to Biscotte restaurant! Restaurant Biscotte offers a cuisine based on fresh, quality products, often local, organic when possible, and always produced by passionate producers.",
    "name": "Biscotte Restaurant"
  },
  {
    "category": {
      "category": "Brunch"
    },
    "description": "Welcome to Biscotte restaurant! Restaurant Biscotte offers a cuisine based on fresh, quality products, often local, organic when possible, and always produced by passionate producers.",
    "name": "Biscotte Restaurant"
  }
]