Giter Site home page Giter Site logo

fep-backend's Introduction

FEP - Backend

Steps to run the project

Make sure Postgress is installed Run these commands to create databases

CREATE DATABASE AUTH;
CREATE DATABASE PROF;
CREATE DATABASE STUDENT;
CREATE DATABASE APPLICATION;
  1. Change secret.yml.template to secret.yml and enter the passwords for your email and db.

NOTE: Use iitk email address, and just add your username, for e.g. : bmerchant22, not [email protected]

  1. Run go mod tidy

  2. Run the project: go run cmd/main.go cmd/auth.go cmd/project.go cmd/student.go cmd/admin.go cmd/prof.go NOTE: Configs are set for /backend as root, so don't run go run cmd/main.go cmd/auth.go cmd/project.go cmd/student.go cmd/admin.go in cmd/

Create User:

  1. On postman Enter POST: http://localhost:8084/api/auth/otp with payload
{
   "user_id": "[email protected]"
}
  1. Then open psql shell and run \c auth
  2. Run select user_id, otp from otps;
  3. Copy the otp corresponding to the user_id
  4. Paste it in signup route payload ie, POST http://localhost:8084/api/auth/signup Payload
{
 "user_id" : "[email protected]",
 "password" : "passqord",
 "user_otp" : "otp" //copied from step 3
}

Change Role_id :

  1. Open your psql shell
  2. Run \c auth
  3. Run UPDATE users set role_id = 100 where user_id = <your_userid> ;

Services

Currently, if you run the project, there are the following services running:

  1. Auth: This service will be running on 8084 port of your machine by default, to change it, you can change the config, it has the following routes: a. /api/auth/sendotp (POST): If you hit this route with your user_id in payload (which is your roll no.), you will get an otp on your mail. b. /api/auth/signup (POST): If you hit this route with user_id, username and password, you will be signed up i.e. your details will be saved in the postgresql db running on your local

  2. Prof Registration(Only via admin side): Service running on port : 8081, But to access these routes you must have admin role id ie 100, kindly refer how to change role_id

    Routes

    • To register Prof:

      POST: /api/admin/prof 
      
    • To get all registered Prof:

      GET: /api/admin/prof 
      
    • To get specific Prof by id:

      GET: /api/admin/prof/:pid 
      
    • To Update Prof Prof:

      PUT: /api/admin/prof 
      
    • To Delete Prof:

      DELETE: /api/admin/prof/:pid 
      

fep-backend's People

Contributors

piyushsingal3 avatar akshatgupta15 avatar bmerchant22 avatar karankk-05 avatar

Watchers

Adarsh J avatar Mridul Verma avatar Ankush Sachdeva avatar Shivanshu Agrawal avatar Pallav Agarwal avatar Kunal Kapila avatar Ayush Bansal 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.