You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/basics/serving-static-files.md
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,11 @@ sidebar_position: 6
4
4
5
5
# Serving Static Files 📁
6
6
7
-
Dart Frog supports serving static files including images, text, json, html, and more. To serve static files, place the files within the `public` directory at the root of the project.
7
+
Dart Frog supports serving static files including images, text, json, html, and more.
8
+
9
+
## Overview 🚀
10
+
11
+
To serve static files, place the files within the `public` directory at the root of the project.
8
12
9
13
For example, if you create a file in `public/hello.txt` which contains the following:
10
14
@@ -33,3 +37,25 @@ In production, only files that are in the `/public` directory at build time will
33
37
:::caution
34
38
Be sure not to have a static file with the same name as a file in the `/routes` directory as this will result in a conflict.
35
39
:::
40
+
41
+
## Using a Custom Directory ✨
42
+
43
+
Even though Dart Frog uses the `public` directory for serving static files by default, you can also specify a custom directory by creating a [custom entrypoint](/docs/advanced/custom_entrypoint).
44
+
45
+
Create a `main.dart` at the root of your project with the following contents:
46
+
47
+
```dart
48
+
import 'dart:io';
49
+
50
+
import 'package:dart_frog/dart_frog.dart';
51
+
52
+
Future<HttpServer> run(Handler handler, InternetAddress ip, int port) {
0 commit comments