Skip to content

Commit 94f9349

Browse files
author
Kristjan Kosic - Chris
committed
docs: readme updates
1 parent 90664eb commit 94f9349

File tree

1 file changed

+32
-41
lines changed

1 file changed

+32
-41
lines changed

README.md

+32-41
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# ARK Core - dApp Template Project
1+
# ARK Core - dApp Template Project With HTTP Server Skeleton Code
22

33
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.
44

55
> This Example is currently operational only on our `core/develop` branch!
66
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).
88

99
## dApp Creation Steps
1010

@@ -34,7 +34,7 @@ cd packages/core/bin/config/testnet
3434

3535
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.
3636

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:
3838

3939
```javascript
4040
"@arkecosystem/core-exchange-json-rpc": {
@@ -45,7 +45,7 @@ Add line `"@arkecosystem/dappname": {}`: to the end of the `plugins.js` file, so
4545
whitelist: ["127.0.0.1", "::ffff:127.0.0.1"],
4646
},
4747
"@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)
4949
```
5050

5151
> 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
7373
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):
7474

7575
```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
7878
```
7979

8080
> Congratulations. Your first distributed blockchain application is loaded and working and compatible with any ARK Core based blockchain.
8181
82+
Now, let's test our new HTTP server. The default registered route should return "Hello Arkies!". Let's try it out:
83+
84+
```bash
85+
curl --request GET \
86+
--url http://127.0.0.1:5003/
87+
```
88+
89+
You should receive the following response:
90+
```json
91+
{
92+
"data": "Hello World!"
93+
}
94+
```
95+
96+
You can see the code and registered route here:
97+
https://github.com/learn-ark/dapp-core-module-http-server-template/blob/master/src/server.ts#L49-L56.
98+
99+
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:
82105
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:
83106

84107
- wallets and state
@@ -90,48 +113,16 @@ Feel free to look into `common/base-service.ts` class that exposes important Cor
90113

91114
> Also check other packages/modules as they follow the same dApp structure.
92115
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.
96-
97-
```bash
98-
git clone https://github.com/arkecosystem/explorer
99-
cd explorer
100-
101-
yarn install
102-
103-
yarn serve:testnet
104-
```
105-
106-
After running `yarn serve:testnet` you should see the following:
107-
108-
```bash
109-
DONE Compiled successfully in 11030ms 11:07:14 AM
110-
111-
No type errors found
112-
Version: typescript 3.6.3
113-
Time: 6973ms
114-
115-
App running at:
116-
- Local: http://localhost:8080/
117-
- Network: http://192.168.0.178:8080/
118-
119-
Note that the development build is not optimized.
120-
To create a production build, run yarn build.
121-
```
122-
123-
Head over to http://localhost:8080/ to view contents of local running blockchain with Testnet environment setup.
116+
#### Use Block Explorer To View Local Running Testnet
124117

118+
Click here to setup local blockchain explorer in a few simple steps:
119+
https://learn.ark.dev/core-getting-started/setup-local-blockchain-explorer
125120
---
126121

127122
> Congrats, your dapp is loaded. Now look at the resources below to understand more about our dapp development.
128123
129124
- [Learn Development With ARK](https://learn.ark.dev)
130125

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.
134-
135126
## License
136127

137128
[MIT](LICENSE) © [ArkEcosystem](https://ark.io)

0 commit comments

Comments
 (0)