Giter Club home page Giter Club logo

js_uw_module3's Introduction

Project overview

I am working on an API for an ads bulletin board. The board allows posting of public ads which can have an expiration date and owner's contact details. I am using a simple authorization to give more privileges to admin, while a normal user will have a smaller set of abilities. For a registered user, there will be an option to have a subscription. Subscription will increase limits for ads publishing.

User roles :

  • Admin. A user with an "admin" role should be able to create, update and delete ads created by any user. Only an admin should be able to update ads that are not their own, either active or inactive.

  • Registered User. A user should be able to create, update, delete only their own ads. They can browse other's ads and get owner's contact info for active ads.

  • Anonymous User. A user should be able only to view active ads and get owner's contact details.

Subscription states :

  • Active. Each active subscription has its start date and duration in days.
  • Inactive.

Ads statuses :

  • Active
  • Inactive

Requirements

My project will require an Express API using:

  • Authentication and Authorization:

    1. Login and authentication will be implemented with JWT which will be generated using the jsonwebtoken library. I will be using middleware to enforce authentication and authorization.

    2. For securely storing passwords I will be using bcrypt library.

  • CRUD routes, data models, DAOs:

    1. Using MongoDB for storing data and CRUD operations.

    2. Routes for a user to sign up, login, logout, and change password. This will use a User model and corresponding DAO methods.

    3. Routes for Ads along with Ads model and corresponding DAO methods.

    4. Routes for Subscription along with Subscription model and corresponding DAO methods.

    • Login
      • Signup: POST /login/signup
      • Login: POST /login
      • Logout: POST /login/logout
      • Change Password POST /login/password
    • Ads
      • Create: POST /ads
      • Get all ads: GET /ads
      • Get a single ad: GET /ads/:id
      • Update: PUT /ads/:id
      • Delete: DELETE /ads/:id
      • Get an ad owner contacts: GET /ads/:id/contacts
    • Subscription
      • Create: POST /subscription
      • Get all subscriptions: GET /subscription
      • Get a single subscription: GET /subscription/:id
      • Update: PUT /subscription/:id
      • Delete: DELETE /subscription/:id
  • Routes are fully tested using Jest: project test coverage > 80%.

  • Postman collection to interact with API.

Project Phases

  • Project proposal created. - Done.
  • Most of the unit tests for the routes are in place. - Done.
  • Unit tests are passing. Prototype/proof of concept is in place. - Done.
  • Postman collection created. - Done.
  • Project submission, presentation. - Done

What to improve

  • Implement revoke a token for logout.
  • Github Actions: trying to figure out why Github CI npm tests are failing while locally they are running OK.

js_uw_module3's People

Contributors

ybalenko avatar

Watchers

 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.