Skip to content

Onchain Surveys will allow users to create public surveys to collect opinions from the blockchain communities to let the community make decisions and provide sentiment in a decentralized manner.

License

Notifications You must be signed in to change notification settings

ggurbet/on-chain-surveys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is Onchain Surveys

Onchain Surveys will allow users to create public surveys to collect opinions from the blockchain communities to let the community make decisions and provide sentiment in a decentralized manner.

API SETUP

Step 1: Clone this project to www or htdocs folder

git clone https://github.com/onchainsurveys/onchain.git

Step 2: Install packages for API

Navigate to the api folder from your terminal screen and run the following command.

npm i
npm start

Step 3: Mongodb

You should have a mongodb account. The URI connection string needs username, password and cluster name with attached id. If not, create an account and get the uri string from https://www.mongodb.com/

Change the mongodb fields according to you in the .env file in the api folder.

Step 4: Run the project

Run the following code on the terminal screen and visit the http:https://localhost:8800 link.

Step 5: Endpoints

Endpoints Description Acceptable values Method
/api/surveys add a new survey to db POST
/api/surveys/id update an existing survey with the id parameter ObjectId PUT
/api/surveys/id delete an existing survey with the id parameter ObjectId DEL
/api/surveys/ view all surveys from db GET
/api/surveys/id view a product by id from json file ObjectId GET
/api/surveys/pending/0 view all pending surveys number GET
/api/pending/1 view all opened surveys from db number GET
/api/auth/register add a new user to db POST
/api/auth/login check for existing userto login POST
/api/users/admincheck/id check admin ObjectId GET
/api/users/usercheck/id check user ObjectId GET
/api/users/id modify a user using id ObjectId PUT
/api/surveys/getmysurvey/username get surveys created by username username GET

CLIENT SETUP

Step 1: Install packages for CLIENT

Navigate to the client folder from your terminal screen and run the following command.

npm i
npm start

and then visit http:https://localhost:3000

Step 2:

Add the following codes to your .htaccess file.

  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]

Testing

We use Cypress for testing the portal's critical functionality. In order to run the test suite, you will need to copy the example cypress.example.json to cypress.json and enter your variables. Then after a successful build, npm run cypress-run for a headless unit test, or npm run cypress-open for a more detailed test interface.

npm install cypress
npx cypress open

About

Onchain Surveys will allow users to create public surveys to collect opinions from the blockchain communities to let the community make decisions and provide sentiment in a decentralized manner.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages