Giter VIP home page Giter VIP logo

profile-service-rds's Introduction

User-Profile-Service-RDS

Introduction

To join the community Real Dev Squad, follow the instructions below and you will get the Discord Invite Link to join the server.

Profile Service Feature

  • User Profile Service consists of 3 APIs /health, /profile and /verification
  • This is a template for creating your own NodeJs backend code of profile service.
  • /health checks whether the server is up and running
  • /profile returns data of the user to whom profile Service belong to. It is protected API so that not anyone can take your information.
  • /verification API returns a hash based on the special chaincode generated by user at identity service.
  • This service is used by Real Dev Squad to connect and help new people come aboard to learn development.

Tutorial

What are you building?

Profile Service is your own service which will be deployed and verified by you with the help of some precreated APIs and contains all the relevant data of yours, used for building your profile and getting yourself a identity in Real Dev Squad. This service will be maintained by you throughout the term of your journey in Real Dev Squad.

Pre-requisites (Should be installed)

Steps to Follow

Step 1

Fork the Template Repository from top right corner

image

Step 2

Create a new fork, ensure that Owner is selected as your GitHub username and repository name can be named as :

<YOUR_NAME>'s-profile-service

Example : rohan's-profile-service

image

Step 3

Now when you have forked the repository. We will clone the repository in our PC.

Click on Code button on right just above code

gitclone

Ensure that HTTPS is selected and copy the link

Now enter following command in terminal to clone repository:

git clone <link you have copied>

Step 4

Open the cloned repository in VScode or your code editor

Step 5

Open New Terminal in VSCode and run following command yarn or yarn install This will bring in all the packages and dependencies if any left.

Maing It your own

Now we will create a file local to you that contains all your profile data. We will use environment variables so that only you and authorized RDS service can access your data and not anyone who has your deployment link

Step 1:

Add a file in your main folder and name it as .env

Step 2:

Copy following data in your .env file and replace right side values with your real information

FIRST_NAME='first_name'
LAST_NAME='last_name'
EMAIL='email_id'
PHONE='your contact number'
YOE=your years of experience
COMPANY='Your company / University you are in'
DESIGNATION='Current Role'
GITHUB_ID='github_id'
LINKEDIN_ID='linkedin_id'
TWITTER_ID='twitter_id'
INSTAGRAM_ID='instagram_id'
WEBSITE='your portfolio website. Leave empty if not there'
CHAIN_CODE='Your chain code. Will be generated in further steps when deploying'

Step 3:

Add a gitignore file and add .env file in it so it is not tracked and your personal information is never uploaded to Github.

Lets Test It

Now we will test if our profile service is working on our local device before deploying

Step 1

Open Insomnia and select debug in top center of screen

image

You will see above screen

Step 2

Now go to VSCode and open your profile service and type following code in new terminal: yarn run dev This command will run your service locally

Step 3

Open Insomnia and enter following link with GET Request http://localhost:8000/health

image

image

Congratulations you have run your first service and tested your first API ๐ŸŽ‰๐ŸŽ‰

Step 4

To test other APIs we need to deploy our service and generate chaincode from RDS identity service which is used to verify your profile service

Deployment

Now we will deploy our service so that it is running on a server and accessible to everyone and is not running only locally on your machine.

Step 1

Login to your Heroku account.

image

Step 2

Click on New and you will see dropdown having two options i.e. Create New App and Create New Pipeline

image

Click on Create New App

Step 3

Now, you will be directed to a new page where you have to create your new heroku app

image

Enter the valid app name as per your choice, make sure you have entered a name relevant to the app and available on Heroku.

image

Then click on Create App. Wohoo!! you have successfully created your Heroku app, now you have to deploy the code in your local to Heroku.

Step 4

Now you will seeing your deploy section of the Heroku app as below.

image

In the middle of the page, you will be able to see various deployment methods like Heroku Git or GitHub etc. You can use either of them, mostly we use Heroku Git or GitHub one.

If you select Heroku Git, there will be instructions given just below the options to execute in your Terminal/Command Line Interface

Follow the instructions as per in the given order

image

After you have run this command git push heroku master Wait for few minutes or seconds to get the deployment done Awesome ๐Ÿฅณ ๐ŸŽ‰, your service is deployed and you can access your deployed service with the provided url by Heroku

Step 5

Now Open Heroku and go to the settings in the app you created.

Step 6

You will find Configure Vars there. Click on Reveal Config Vars

config Cars

Step 7

Now you will find a box for Key, one box for Value and one Add button. Copy first key from your .env file into KEY box and copy its value(Without apostrophee) in VALUE box and click on Add button. For empty values leave the VALUE box empty and click Add button

keyval

Step 8

Do Step 7 Repeatedly for all values of .env file but leave chaincode because that will be generated later on.

Step 9

And you are done with deployment. Now only deployment link which is protected and you have your personal info and cannot even be uploaded by mistake on Github.

Joining Us

Now you will be linking your deployed service with us i.e. RDS.

Step 1

Go to Real Dev Squad website and click on Sign In With GitHub button in the navbar as shown below.

image

Link your GitHub account, and complete the SignUp steps. Note : Only for users who don't have an account on Real Dev Squad website or who haven't linked their GitHub account on Real Dev Squad website.

Step 2

Go to My Site or you can simply click the user greeting as shown below (this is after you have Signed In with your GitHub account)

image

Once you landed on my-site, you will have to go to Identity Tab (P.S. you can directly click on this hyperlink to get you to the desired page).

Step 3

You get to see something like the below form

image

Click on Generate Chaincode, an alert will appear, click OK to generate the chaincode.

image

Click on Copy to copy the chaincode. Note : Keep this generated code very safely as you will be able to see it once only.

Step 4

Now open .env file in your profile service and paste the copied chaincode in front of CHAIN_CODE key. Also Update the chaincode in Configure Vars in deployment as discussed in Step 7 of Deployment. Now we have completed all the information.

Step 5

Run these commands in your terminal to push the code to your deployed service through the Heroku CLI

git add .

git commit -am "<ENTER_YOUR_COMMIT_MESSAGE>"

git push heroku master

If you were using the second method of GitHub to deploy your service

git add .

git commit -am "<ENTER_YOUR_COMMIT_MESSAGE>"

If your branch name is master then use this

git push origin master

Otherwise,

git push origin <ENTER_YOUR_BRANCH_NAME>

Step 6

Now that you have pushed your code with the chaincode. Enter your deployed service URL here.

image

And click on Save. After that Check the checkbox to ensure that you have done both the steps correctly. Then, click on Link Chaincode. Woooh, now wait for few seconds or minutes to get your service verified by the Real Dev Squad service. Once you are verified you will get to see a verification message that your verification is completed.

image

Awesome, Congratulations ๐Ÿฅณ ๐ŸŽ‰ on becoming a user in Real Dev Squad and

Welcome to Real Dev Squad ๐Ÿฅณ ๐ŸŽ‰

**Note : ** If you are unable to verify your service or their are some errors that you get encountered. Please reach out to members of Real Dev Squad from here

Additionl Information

  1. You can run yarn run test cmd in local after completing all information and see if any test is failing. If any of the test is failing please re check the information entered by you in .env file. These tests check the functionality of all three APIs.

profile-service-rds's People

Contributors

rahulgoyal-tech avatar

Stargazers

Roman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.