Skip to main content

Running the API

Overview

The Flutter News Example API is written in Dart and uses Dart Frog.

Running the API server locally

To launch the server locally, run the following command from the current directory:

dart_frog dev

This starts the server on localhost:8080.

Running the API server in Docker

To run the server in Docker, make sure you have Docker installed, then use the following instructions:

  1. Create a production build with the following command:
dart_frog build
  1. Switch directories into the generated build directory:
cd build
  1. Create a Docker image:
docker build -q .

Once you have created an image, run it using the following command:

docker run -d -p 8080:8080 --rm <IMAGE>

To kill the container:

docker kill <CONTAINER>

To delete an image:

docker rmi <IMAGE>

API documentation

Find the service API documentation in docs/api.apib. The documentation uses the API Blueprint specification. Preview the doc using the Apiary Client.

Running the documentation locally

To run the interactive API documentation locally, make sure that you have the Apiary Client installed:

$ gem install apiaryio

Then use the preview command to run the documentation:

$ apiary preview --path docs/api.apib --watch

The interactive documentation is available at localhost:8080.

For more information, refer to the Apiary Client Documentation.

Contributing to the API documentation

For documentation and tutorials on using the API Blueprint specification, refer to APIBlueprint.org.

For more information, refer to the API Blueprint Specification.

We recommend that you install the API Elements VSCode Extension to provide syntax highlighting and show errors and warnings when using invalid syntax.