Copy
$ cd scavenge
$ starport serve
Cosmos version is: Launchpad
📦 Installing dependencies...
🛠️ Building the app...
🙂 Created an account. Password (mnemonic): wheat wonder cherry please actor armed angry suggest square fringe confirm unusual equip access symbol visit cry hen one fat absorb stamp miracle alone
🙂 Created an account. Password (mnemonic): idea snack life aware merit rough end shadow pond tide sweet column visual report multiply bronze claw cry bamboo payment taxi glare process immune
🌍 Running a Cosmos 'scavenge' app with Tendermint at http://localhost:26657.
🌍 Running a server at http://localhost:1317 (LCD)
🚀 Get started: http://localhost:12345/
From the output above, we can see the following has occurred:
Two accounts were created with the respective mnemonics(opens new window). Later on in this tutorial, you'll use them to log in and interact with your application.
Our Tendermint consensus engine (think of it as a database) is running at http://localhost:26657
A web server is running at http://localhost:1317
A landing page is running at http://localhost:12345
Before starting up our application, the serve command runs a build for our Cosmos SDK application as well as our Vue frontend.
The build process executed by starport serve is similar to running make install in the following Makefile.
Copy
PACKAGES=$(shell go list ./... | grep -v '/simulation')
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=NewApp \
-X github.com/cosmos/cosmos-sdk/version.ServerName=scavenged \
-X github.com/cosmos/cosmos-sdk/version.ClientName=scavengecli \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)
BUILD_FLAGS := -ldflags '$(ldflags)'
.PHONY: all
all: install
.PHONY: install
install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/scavenged
go install -mod=readonly $(BUILD_FLAGS) ./cmd/scavengecli
npm --prefix ./vue i --save
npm --prefix ./vue run build
go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify
# Uncomment when you have some tests
# test:
# @go test -mod=readonly $(PACKAGES)
.PHONY: lint
# look into .golangci.yml for enabling / disabling linters
lint:
@echo "--> Running linter"
@golangci-lint run
@go mod verify
After building the application, the serve command initializes the application based on the information provided in the config.yml file:
In a separate terminal, you can also cd into the vue directory and run npm i && npm run serve to start your frontend app.
Copy
App running at:
- Local: http://localhost:8080/
- Network: http://10.0.0.92:8080/
Note that the development build is not optimized.
To create a production build, run npm run build.
Let's run starport serve again, as it does additional hot reloading for our app out of the box. After this, we can navigate to localhost:12345(opens new window), where we should see the following landing page:
This landing page re-iterates the fact that we have a web server, consensus engine, and frontend vue application running.
Let's visit our vue app at localhost:8080:
You can use this page to sign in using the mnemonics provided in your terminal, as well perform CRUD operations on your application.
Currently, it only contains the boilerplate application which lets you sign in, but will contain additional contents after you scaffold some types.
Since we didn't add any types, we will start defining them in the next section.