vechain-nest-server
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Vechain Backend API

Installation

$ npm install

Start postgresql locally and set up db

> brew services start postgresql
> psql postgres

postgres=# create role ProjectName with password '123456';
CREATE ROLE
postgres=# alter role ProjectName login superuser inherit createdb createrole replication;
ALTER ROLE
postgres=# create database ProjectName;
CREATE DATABASE
postgres=# grant all privileges on database ProjectName to ProjectName;
GRANT
postgres=# grant all privileges on all tables in schema public to ProjectName;
GRANT
postgres=# \q

or download postgresql app
https://www.postgresql.org/download/

setup the login user
Add the new database

change the .env file
DATABASE_USER=postgres
DATABASE_PASSWORD=123456
DATABASE_NAME=dbname
DATABASE_HOST=localhost

Alternative Postgres run with Docker

If you are familiar with docker and you don't want to install postgres, you can use docker-compose to spin up the database. Simply run the following:

docker-compose up

# optional: to view the database data
# go to http://localhost:8098
# select system = db, username = postgres,
# password = 123456, database = dbname

Prepare terminal with environment variables

# make a copy of environment variables
$ cp .env.sample .env

# edit .env with an editor, eg vim
$ vim .env

# add to environment
$ source .env

Edit values to reflect local configuration environment

Run migrations

$ npm run migrate:up

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

View API docs at http://localhost:3001/api or download json for import into postman with http://localhost:3001/api-json

Deploy your application to Heroku

$ git add .
$ git commit -am "commit"
$ git push heroku main

Vechain Environment Setup

Copy API into src/abis folder Modify Contract Address inside chain/chain.service.ts

endpoints to fetch all NFTs

usernfts/getallnfts

endpoints to fetch one NFT

usernfts/getnft

endpoints to fetch all NFT tokenIds

usernfts/getTokenIds

endpoints to update one NFT attribute

usernfts/updateattribute

Readme

Keywords

none

Package Sidebar

Install

npm i vechain-nest-server

Weekly Downloads

0

Version

0.0.2

License

UNLICENSED

Unpacked Size

392 kB

Total Files

182

Last publish

Collaborators

  • dangloi