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: README.md
+32-41
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
# ARK Core - dApp Template Project
1
+
# ARK Core - dApp Template Project With HTTP Server Skeleton Code
2
2
3
3
This is a basic template project for ARK core dApp development. Create a new project based on this template and load your plugin into the corresponding network configuration by following the steps below.
4
4
5
5
> This Example is currently operational only on our `core/develop` branch!
6
6
7
-
This template project provides initial structure for your dApp development.
7
+
This template project provides initial structure for your dApp development with a HTTP Server Implemented (using HAPI).
8
8
9
9
## dApp Creation Steps
10
10
@@ -34,7 +34,7 @@ cd packages/core/bin/config/testnet
34
34
35
35
Locate file `plugins.js`. We will add our dApp name to end of the list of the loaded plugins. This means that core will pickup the dapp and load it for a specific network configuration.
36
36
37
-
Add line `"@arkecosystem/dappname": {}`: to the end of the `plugins.js` file, so it looks something like this:
37
+
Add line `"@learn-ark/dapp-custom-module-name": {}`: to the end of the `plugins.js` file, so it looks something like this:
38
38
39
39
```javascript
40
40
"@arkecosystem/core-exchange-json-rpc": {
@@ -45,7 +45,7 @@ Add line `"@arkecosystem/dappname": {}`: to the end of the `plugins.js` file, so
45
45
whitelist: ["127.0.0.1", "::ffff:127.0.0.1"],
46
46
},
47
47
"@arkecosystem/core-snapshots": {},
48
-
"@vendorname/dappname": {}, //our application hook (here we load the plugin/dapp, as defined in your dapp package.json)
48
+
"@learn-ark/dapp-core-module-http-server-template": {}, //our application hook (here we load the plugin/dapp, as defined in your dapp package.json)
49
49
```
50
50
51
51
> Make sure to run `yarn setup` from the `core` root folder when you change or add code to `core/plugins`
@@ -73,12 +73,35 @@ If you already have running and compiled core, you should go to `core/packages/c
73
73
After local testnet starts, the log should show that dApp was loaded. It should look like this (if you haven't changed the source code):
74
74
75
75
```bash
76
-
[2019-10-22 11:13:27.161] INFO : Starting dApp
77
-
[2019-10-22 11:13:27.161] INFO :Initialization of dApp
76
+
[2019-12-04 10:23:58.269] INFO : Starting dApp
77
+
[2019-12-04 10:23:58.273] INFO :Custom HTTP Public HTTP API Server running at: http://0.0.0.0:5003
78
78
```
79
79
80
80
> Congratulations. Your first distributed blockchain application is loaded and working and compatible with any ARK Core based blockchain.
81
81
82
+
Now, let's test our new HTTP server. The default registered route should return "Hello Arkies!". Let's try it out:
Now you can start playing around, adding more custom endpoints.
100
+
101
+
>If you plan to add a lot of routes make sure to checkout the official `core-api` package and follow its best-practices.
102
+
103
+
104
+
### Optional:
82
105
Feel free to look into `common/base-service.ts` class that exposes important Core Platform classes that you can work with. Your newly developed classes can extend this class and gain access to:
83
106
84
107
- wallets and state
@@ -90,48 +113,16 @@ Feel free to look into `common/base-service.ts` class that exposes important Cor
90
113
91
114
> Also check other packages/modules as they follow the same dApp structure.
92
115
93
-
## Use Block Explorer To View Local Running Testnet
94
-
95
-
The following code instructions will run a local copy of ARK Explorer and connect to local node.
> Congrats, your dapp is loaded. Now look at the resources below to understand more about our dapp development.
128
123
129
124
-[Learn Development With ARK](https://learn.ark.dev)
130
125
131
-
## Security
132
-
133
-
If you discover a security vulnerability within this package, please send an e-mail to [email protected]. All security vulnerabilities will be promptly addressed.
0 commit comments