Skip to content

Commit 079e1c4

Browse files
committed
Update README.md
1 parent 20381c1 commit 079e1c4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This is a simple file-based routing fasitfy application skeleton for JSON API server with some pre-defined features.
66

7-
After calling the default exported function, the fastify server will listen on the specified host and port. The returned value of the function is a fastify instance.
7+
After calling the exported `init()` and `start()` functions, the fastify server will listen on the specified host and port. The default export is a fastify instance.
88

99
## File-based routing
1010

@@ -135,8 +135,6 @@ By default, the server will log the API error(`throw new ApiError()`). This beha
135135
npm install fastify-app js-yaml
136136
```
137137

138-
> **Note**
139-
>
140138
> The `js-yaml` can be omitted if you don't want to use a yaml config file.
141139
142140
### Create a config file
@@ -178,10 +176,13 @@ Create an `app` folder in your project root, and create a js file in it, `api.js
178176

179177
```javascript
180178
'use strict';
181-
const {ApiError} = require('fastify-app');
179+
180+
const {default:fastifyAppInstance, ApiError} = require('fastify-app');
182181
183182
module.exports = function() {
184183
// Put custom code here, runs before fastify initializing.
184+
// The fastifyAppInstance is the fastify instance.
185+
// You can use fastifyAppInstance to register plugins, decorators, etc.
185186
// your custom code
186187
187188
// then return your plugin function to the fastify register.

0 commit comments

Comments
 (0)