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: application.md
+75-2Lines changed: 75 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,9 @@ You’ll find bootstrapping files for HTTP and console applications inside of th
11
11
12
12
13
13
## IoC Container
14
-
Supercharge’s `Application` class is also an [IoC container](/docs/service-container) used to manage class dependencies. This allows apps to follow the concept of dependency injection.
14
+
Supercharge’s `Application` class is also an [IoC container](/docs/service-container) used to manage class dependencies. This allows apps to follow the concept of dependency injection. Find more details about the service container in the related docs:
15
15
16
-
👉 [IoC Container docs](/docs/service-container)
16
+
👉 [IoC Service Container docs](/docs/service-container)
17
17
18
18
## Start a Web Application
19
19
The `server.ts` file in your root directory contains the logic to serve a Supercharge web app. It creates a new application and starts the HTTP server. Serving an HTTP server is as simple as invoking the `server.ts` file with Node.js to start a web application:
@@ -30,3 +30,76 @@ The `craft.ts` file in your application directory is the entry point to serve a
30
30
ts-node craft.ts
31
31
```
32
32
33
+
34
+
## Application Paths
35
+
You’ll find references to Supercharge’s `app` instance in most parts of the framework. And also within the documentation. The reason is that your `app` instance is the central place storing the base path to your application’s directory. Your base directory is the starting point to resolve paths to directories in your Supercharge application.
36
+
37
+
38
+
### `App.basePath()`
39
+
The `App.basePath` method returns the absolute path to your application’s root directory:
The `App.configPath` method returns the absolute path to your application’s `config` directory. You can also generate an absolute path to a given file within the configuration directory:
49
+
50
+
```ts
51
+
const path =app.configPath()
52
+
// <base-path>/config
53
+
54
+
const path =app.configPath('app.ts')
55
+
// <base-path>/config/app.ts
56
+
```
57
+
58
+
59
+
### `App.publicPath()`
60
+
The `App.publicPath` method returns the absolute path to your application’s `public` directory. You can also generate an absolute path to a given file within the public directory:
61
+
62
+
```ts
63
+
const path =app.publicPath()
64
+
// <base-path>/public
65
+
66
+
const path =app.publicPath('js/app.js')
67
+
// <base-path>/public/js/app.js
68
+
```
69
+
70
+
71
+
### `App.resourcePath()`
72
+
The `App.resourcePath` method returns the absolute path to your application’s `resources` directory. You can also generate an absolute path to a given file within the resources directory:
73
+
74
+
```ts
75
+
const path =app.resourcePath()
76
+
// <base-path>/resources
77
+
78
+
const path =app.resourcePath('js/app.ts')
79
+
// <base-path>/resource/js/app.ts
80
+
```
81
+
82
+
83
+
### `App.storagePath()`
84
+
The `App.storagePath` method returns the absolute path to your application’s `storage` directory. You can also generate an absolute path to a given file within the storage directory:
85
+
86
+
```ts
87
+
const path =app.storagePath()
88
+
// <base-path>/storage
89
+
90
+
const path =app.storagePath('cache/sessions')
91
+
// <base-path>/storage/cache/sessions
92
+
```
93
+
94
+
95
+
### `App.databasePath()`
96
+
The `App.databasePath` method returns the absolute path to your application’s `database` directory. You can also generate an absolute path to a given file within the database directory:
0 commit comments