Introduction
The Latitude CLI is a command-line tool that allows you to manage your Latitude projects. It provides a set of commands to help you create and serve your Latitude projects. To get a list of all available commands, you can run the following command:Creating a new project
To create a new Latitude project, you can use thestart command. This command will create a new directory with the specified project name and initialize it with the necessary files and folders.
start command will prompt you to enter the name of your new project. Once you’ve entered the name, the command will create a new directory with the specified name and initialize it with the necessary files and folders.
Local development
To serve your Latitude project locally, you can use thedev command. This command will start a local development server that will serve your project on http://localhost:3000.
Running queries
To check that your queries are working as expected, you can run them locally using therun command. For example:
/queries/sample.sql query once and display the results in your terminal.
If your query is in a sub-folder within the /queries folder, make sure to include the sub-folder name in the command. For example:
Watch mode
If you want to run the query in watch mode, you can add the-w or --watch flag to the command. For example:
Passing parameters
If you’re using parameters in your query, you can pass them to therun command using the --param flag, followed by the parameter name and value. For example:
name and id parameters will receive the values Latitude and 1, respectively.
Debugging queries
You can use the--debug flag to display the actual query that would be sent to your database, without actually running it. For example: