Code Monkey home page Code Monkey logo

voting-app-backend's Introduction

Installation

npm install

Run

npm run serve

Configuration

  • Copy and rename .env.default to .env
  • Add your parameter
  • Note: Checked in the .env file. Passwords can be changed

Create your PEM files

Create your public and private key for the JWT signature:

$ openssl genrsa -out config/jwt/private.pem -aes256 4096
$ openssl rsa -pubout -in config/jwt/private.pem -out config/jwt/public.pem

Features

  • JWT Authentification with PEM file based signature and passphrase
  • API Routes for registration and login

#API

USER MODULE

\users\register : POST : Create a new User

  • Requires name, email and password
  • secret can be passed to create Admin user

\users\login : POST : Log into the appplication

  • Requires email and password
  • Returns a JWT token

CANDIDATE MODULE

\candidate : GET : Get a list of candidates

  • Requires Authorization header with a Bearer token
  • Returns list of candidates
  • If user is Admin total votes for each candidate comes
  • If user is Non-Admin his/her previous votes are returned

\candidate : POST : Create a new candidate

  • Only Admin user ca create a candidate
  • Returns the id of the newly created candidate
  • Requires a candidateName

candidate\vote\:cadidateId : GET : Votes for a candidate

  • Only Non Admin user can vote
  • A user can only vote once

voting-app-backend's People

Contributors

saurabhgupta050890 avatar

Watchers

James Cloos avatar  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.