浏览代码

added export and return statements to examples

pKorsholm 3 年之前
父节点
当前提交
c42c0153f3
共有 2 个文件被更改,包括 8 次插入0 次删除
  1. 4 0
      src/api/README.md
  2. 4 0
      src/services/README.md

+ 4 - 0
src/api/README.md

@@ -12,6 +12,8 @@ export default () => {
       message: "Welcome to Medusa!"
     })
   })
+
+  return router;
 }
 ```
 
@@ -31,5 +33,7 @@ export default () => {
       message: `Welcome to ${product.title}!`
     })
   })
+
+  return router;
 }
 ```

+ 4 - 0
src/services/README.md

@@ -20,6 +20,8 @@ class MyService extends BaseService {
     return `Welcome to ${product.title}!`
   }
 }
+
+export default MyService;
 ```
 
 The first argument to the `constructor` is the global giving you access to easy dependency injection. The container holds all registered services from the core, installed plugins and from other files in the `/services` directory. The registration name is a camelCased version of the file name with the type appended i.e.: `my.js` is registered as `myService`, `custom-thing.js` is registerd as `customThingService`.
@@ -39,5 +41,7 @@ export default () => {
       message: await myService.getProductMessage()
     })
   })
+
+  return router;
 }
 ```