iroha2-block-explorer-web
所属分类:其他
开发工具:Vue
文件大小:0KB
下载次数:0
上传日期:2023-12-04 09:16:23
上 传 者:
sh-1993
说明: 通过去中心化技术设计更美好的世界
(Designing a Better World Through Decentralized Technologies)
文件列表:
.dockerignore (69, 2023-12-04)
.env.local.example (69, 2023-12-04)
.eslintignore (6, 2023-12-04)
.eslintrc.js (960, 2023-12-04)
.npmrc (63, 2023-12-04)
.vscode/ (0, 2023-12-04)
.vscode/extensions.json (49, 2023-12-04)
Dockerfile (86, 2023-12-04)
Jenkinsfile (528, 2023-12-04)
index.html (369, 2023-12-04)
nginx.conf (823, 2023-12-04)
package.json (1252, 2023-12-04)
pnpm-lock.yaml (93450, 2023-12-04)
public/ (0, 2023-12-04)
public/favicon.svg (6971, 2023-12-04)
src/ (0, 2023-12-04)
src/app/ (0, 2023-12-04)
src/app/App.vue (1587, 2023-12-04)
src/app/main.ts (350, 2023-12-04)
src/app/router.ts (939, 2023-12-04)
src/entities/ (0, 2023-12-04)
src/entities/account.ts (348, 2023-12-04)
src/entities/domain.ts (373, 2023-12-04)
src/entities/transaction/ (0, 2023-12-04)
src/entities/transaction/TransactionStatus.vue (2061, 2023-12-04)
src/entities/transaction/index.ts (159, 2023-12-04)
src/entities/transaction/model.ts (1434, 2023-12-04)
src/env.d.ts (397, 2023-12-04)
src/features/ (0, 2023-12-04)
src/features/filter-transactions/ (0, 2023-12-04)
src/features/filter-transactions/TransactionStatusFilter.vue (689, 2023-12-04)
src/features/filter-transactions/TransactionTypeFilter.vue (823, 2023-12-04)
src/features/filter-transactions/index.ts (268, 2023-12-04)
src/features/filter-transactions/model.ts (136, 2023-12-04)
src/features/mobile-menu/ (0, 2023-12-04)
src/features/mobile-menu/MobileMenu.vue (1519, 2023-12-04)
src/features/mobile-menu/index.ts (70, 2023-12-04)
src/features/navigation/ (0, 2023-12-04)
... ...
# iroha2-block-explorer-web
This repository is managed by Terraform!
## Build
Node v20+ with Corepack is required.
```bash
corepack enable
pnpm i
pnpm build
```
Build artifacts will be located at `dist` dir.
### Docker
`Dockerfile` with `nginx.conf` are also provided. Based on [Deployment > Docker (nginx)](https://cli.vuejs.org/guide/deployment.html#docker-nginx).
## Development
### Setting up the `.env` file
You need a file with environment variables to configure Vite for the frontend to properly request either mock data or interact with the backend.
To enable the mocks, write:
```
VITE_FAKE_API_ENABLED=TRUE
```
To interact with the backend, assuming you'll add an API proxy as described below, write:
```
VITE_API_URL=http://localhost:5173/api-proxy
```
### Connecting to a BCE backend
One may want to see to see how the backend responds in the real time,
but pointing the API endpoint directly in the `VITE_API_URL` property of an `.env` file
would lead to a lot of errors like this one:
Access to fetch at 'http://localhost:port_A/...' from origin 'http://localhost:port_B' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Vite can be configured to proxy the responses.
So, we first return to the `.env` file and configure `VITE_API_URL` property as `http://localhost:5173/api-proxy`, if our `dev` shows the port as 5173.
Then we go to the Vite configuration in `vite.config.js` and add a new part in our `defineConfig` section,
where our `target` points to the host and the port of our BCE backend instance.
```js
export default defineConfig({
server: {
proxy: {
'/api-proxy': {
target: 'http://127.0.0.1:4000',
changeOrigin: true,
secure: false,
ws: false,
rewrite: (path) => '/api/v1' + path.replace(/api-proxy\//, ''),
},
},
}
})
```
近期下载者:
相关文件:
收藏者: