This is an automated email from the ASF dual-hosted git repository.

hufeng pushed a commit to branch v3.0.0
in repository https://gitbox.apache.org/repos/asf/dubbo-js.git


The following commit(s) were added to refs/heads/v3.0.0 by this push:
     new 615aa7a  refactor hello-egg example
615aa7a is described below

commit 615aa7a13170604c7b2b31649900f685da4a2b70
Author: hufeng <[email protected]>
AuthorDate: Wed Sep 9 22:51:46 2020 +0800

    refactor hello-egg example
---
 .gitignore                                         |  2 +
 examples/hello-egg/.travis.yml                     | 16 -------
 examples/hello-egg/README.md                       |  1 +
 examples/hello-egg/app.ts                          |  3 ++
 examples/hello-egg/app/controller/home.ts          |  3 +-
 examples/hello-egg/app/router.ts                   |  4 +-
 examples/hello-egg/appveyor.yml                    | 16 -------
 examples/hello-egg/package.json                    |  1 -
 .../hello-egg/typings/app/controller/index.d.ts    | 28 ------------
 examples/hello-egg/typings/app/index.d.ts          | 23 ----------
 examples/hello-egg/typings/app/service/index.d.ts  | 35 ---------------
 examples/hello-egg/typings/config/index.d.ts       | 28 ------------
 examples/hello-egg/typings/config/plugin.d.ts      | 50 ----------------------
 13 files changed, 9 insertions(+), 201 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5147a8f..84915e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,3 +55,5 @@ lib
 temp
 es6
 es7
+
+examples/hello-egg/typings
\ No newline at end of file
diff --git a/examples/hello-egg/.travis.yml b/examples/hello-egg/.travis.yml
index 41631a3..a8bb9d7 100644
--- a/examples/hello-egg/.travis.yml
+++ b/examples/hello-egg/.travis.yml
@@ -1,19 +1,3 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one or more
-#  contributor license agreements.  See the NOTICE file distributed with
-#  this work for additional information regarding copyright ownership.
-#  The ASF licenses this file to You under the Apache License, Version 2.0
-#  (the "License"); you may not use this file except in compliance with
-#  the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
 language: node_js
 node_js:
   - '8'
diff --git a/examples/hello-egg/README.md b/examples/hello-egg/README.md
index e52192d..6ef0251 100644
--- a/examples/hello-egg/README.md
+++ b/examples/hello-egg/README.md
@@ -4,6 +4,7 @@
 
 ```bash
 $ cd ../../
+$ make
 $ sh start_dubbo_service.sh
 $ cd examples/hello-egg
 $ yarn
diff --git a/examples/hello-egg/app.ts b/examples/hello-egg/app.ts
index dd7663b..ef2b502 100644
--- a/examples/hello-egg/app.ts
+++ b/examples/hello-egg/app.ts
@@ -19,6 +19,9 @@ import {EggApplication} from 'egg';
 import dubbo from './app/dubbo';
 
 export default async (app: EggApplication) => {
+  /**
+   * init dubbo
+   */
   dubbo(app);
   await app.dubbo.ready();
   app.coreLogger.info('dubbo was ready');
diff --git a/examples/hello-egg/app/controller/home.ts 
b/examples/hello-egg/app/controller/home.ts
index c6d3144..c97174f 100644
--- a/examples/hello-egg/app/controller/home.ts
+++ b/examples/hello-egg/app/controller/home.ts
@@ -23,8 +23,7 @@ import {UserRequest} from 
'../dubbo/providers/org/apache/dubbo/demo/UserRequest'
 
 export default class HomeController extends Controller {
   async index() {
-    const {ctx} = this;
-    ctx.body = await ctx.service.test.sayHi('egg');
+    this.ctx.body = await this.ctx.service.test.sayHi('egg');
   }
 
   async userInfo() {
diff --git a/examples/hello-egg/app/router.ts b/examples/hello-egg/app/router.ts
index d4d5c1c..130fce9 100644
--- a/examples/hello-egg/app/router.ts
+++ b/examples/hello-egg/app/router.ts
@@ -22,7 +22,7 @@ export default (app: Application) => {
 
   router.get('/', controller.home.index);
   router.get('/hello', controller.home.sayHello);
-  router.get('/userInfo', controller.home.userInfo);
+  router.get('/user-info', controller.home.userInfo);
   router.get('/echo', controller.home.echo);
-  router.get('/basicType', controller.home.basicType);
+  router.get('/basic-type', controller.home.basicType);
 };
diff --git a/examples/hello-egg/appveyor.yml b/examples/hello-egg/appveyor.yml
index abbf1b7..c274b7d 100644
--- a/examples/hello-egg/appveyor.yml
+++ b/examples/hello-egg/appveyor.yml
@@ -1,19 +1,3 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one or more
-#  contributor license agreements.  See the NOTICE file distributed with
-#  this work for additional information regarding copyright ownership.
-#  The ASF licenses this file to You under the Apache License, Version 2.0
-#  (the "License"); you may not use this file except in compliance with
-#  the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
 environment:
   matrix:
     - nodejs_version: '8'
diff --git a/examples/hello-egg/package.json b/examples/hello-egg/package.json
index b41cb59..17e05fc 100644
--- a/examples/hello-egg/package.json
+++ b/examples/hello-egg/package.json
@@ -23,7 +23,6 @@
     "clean": "ets clean"
   },
   "dependencies": {
-    "apache-dubbo-js": "^3.0.0-rc6",
     "egg": "^2.11.2",
     "egg-scripts": "^2.9.1",
     "interpret-util": "^0.0.6"
diff --git a/examples/hello-egg/typings/app/controller/index.d.ts 
b/examples/hello-egg/typings/app/controller/index.d.ts
deleted file mode 100644
index 445840d..0000000
--- a/examples/hello-egg/typings/app/controller/index.d.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is created by [email protected]
-// Do not modify this file!!!!!!!!!
-
-import 'egg';
-import ExportHome from '../../../app/controller/home';
-
-declare module 'egg' {
-  interface IController {
-    home: ExportHome;
-  }
-}
diff --git a/examples/hello-egg/typings/app/index.d.ts 
b/examples/hello-egg/typings/app/index.d.ts
deleted file mode 100644
index 8a59867..0000000
--- a/examples/hello-egg/typings/app/index.d.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is created by [email protected]
-// Do not modify this file!!!!!!!!!
-
-import 'egg';
-export * from 'egg';
-export as namespace Egg;
diff --git a/examples/hello-egg/typings/app/service/index.d.ts 
b/examples/hello-egg/typings/app/service/index.d.ts
deleted file mode 100644
index d65ca8a..0000000
--- a/examples/hello-egg/typings/app/service/index.d.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is created by [email protected]
-// Do not modify this file!!!!!!!!!
-
-import 'egg';
-type AnyClass = new (...args: any[]) => any;
-type AnyFunc<T = any> = (...args: any[]) => T;
-type CanExportFunc = AnyFunc<Promise<any>> | AnyFunc<IterableIterator<any>>;
-type AutoInstanceType<
-  T,
-  U = T extends CanExportFunc ? T : T extends AnyFunc ? ReturnType<T> : T
-> = U extends AnyClass ? InstanceType<U> : U;
-import ExportTest from '../../../app/service/test';
-
-declare module 'egg' {
-  interface IService {
-    test: AutoInstanceType<typeof ExportTest>;
-  }
-}
diff --git a/examples/hello-egg/typings/config/index.d.ts 
b/examples/hello-egg/typings/config/index.d.ts
deleted file mode 100644
index 5fbb9b3..0000000
--- a/examples/hello-egg/typings/config/index.d.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is created by [email protected]
-// Do not modify this file!!!!!!!!!
-
-import 'egg';
-import {EggAppConfig} from 'egg';
-import ExportConfigDefault from '../../config/config.default';
-type ConfigDefault = ReturnType<typeof ExportConfigDefault>;
-type NewEggAppConfig = ConfigDefault;
-declare module 'egg' {
-  interface EggAppConfig extends NewEggAppConfig {}
-}
diff --git a/examples/hello-egg/typings/config/plugin.d.ts 
b/examples/hello-egg/typings/config/plugin.d.ts
deleted file mode 100644
index 68523fc..0000000
--- a/examples/hello-egg/typings/config/plugin.d.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is created by [email protected]
-// Do not modify this file!!!!!!!!!
-
-import 'egg';
-import 'egg-onerror';
-import 'egg-session';
-import 'egg-i18n';
-import 'egg-watcher';
-import 'egg-multipart';
-import 'egg-security';
-import 'egg-development';
-import 'egg-logrotator';
-import 'egg-schedule';
-import 'egg-static';
-import 'egg-jsonp';
-import 'egg-view';
-import {EggPluginItem} from 'egg';
-declare module 'egg' {
-  interface EggPlugin {
-    onerror?: EggPluginItem;
-    session?: EggPluginItem;
-    i18n?: EggPluginItem;
-    watcher?: EggPluginItem;
-    multipart?: EggPluginItem;
-    security?: EggPluginItem;
-    development?: EggPluginItem;
-    logrotator?: EggPluginItem;
-    schedule?: EggPluginItem;
-    static?: EggPluginItem;
-    jsonp?: EggPluginItem;
-    view?: EggPluginItem;
-  }
-}

Reply via email to