Skip to content

πŸ‘‹ Hello World

In this tutorial, we’re going to build an app that exposes a single endpoint and responds with a static response.

When we’re done, we should be able to make a GET request to the / endpoint:

Terminal window
curl --request GET \
--url http://localhost:8080

And our server should respond with the following response:

HTTP/1.1 200 OK
Connection: close
Content-Length: 21
Content-Type: text/plain; charset=utf-8
Welcome to Dart Frog!

To create a new Dart Frog app, open your terminal, cd into the directory where you’d like to create the app, and run the following command:

Terminal window
dart_frog create hello_world

You should see an output similar to:

βœ“ Creating hello_world (0.1s)
βœ“ Installing dependencies (1.7s)
Created hello_world at ./hello_world.
Get started by typing:
cd ./hello_world
dart_frog dev

You should now have a directory called hello_world β€” cd into it:

Terminal window
cd hello_world

Then, run the following command:

Terminal window
dart_frog dev

This will start the development server on port 8080:

βœ“ Running on http://localhost:8080 (1.3s)
The Dart VM service is listening on http://127.0.0.1:8181/YKEF_nbwOpM=/
The Dart DevTools debugger and profiler is available at: http://127.0.0.1:8181/YKEF_nbwOpM=/devtools/#/?uri=ws%3A%2F%2F127.0.0.1%3A8181%2FYKEF_nbwOpM%3D%2Fws
[hotreload] Hot reload is enabled.

Make sure it’s working by opening http://localhost:8080 in your browser or via cURL:

Terminal window
curl --request GET \
--url http://localhost:8080

If everything succeeded, you should see Welcome to Dart Frog!.

πŸŽ‰ Congrats, you’ve created a hello_world application using Dart Frog. View the full source code.