GithubHelp home page GithubHelp logo

project-auth's Introduction

Project Auth

For this week's project, we're tying up all the skills we've learnt so far to build an API with authentication to implement a registration flow, and a frontend with forms to register, sign in, and view some content once the user is logged in.

The problem

Below follows what we have implemented in this project.

Backend

  • Created a User model with properties username, password and accessToken using mongoose
  • Set up endpoints for register, login and authenticated (endpoint giving access to "secret" content if the user is registered as a member)
  • The authenticated endpoint returns a status 401 with an error message if a user tries to access it without an access token or an invalid token
  • Validation of user input when creating a new user, which returns error message if the registration fails
  • Created an Inspo model and imported json response to the database with urls (images) from Unsplash. By using mongodb method aggregate.sample a randomized url is sent when a fetch is made from the frontend the API

Frontend

  • Structured pages and components and allocated code accordingly (sign in/up form, main page displaying secret content, sign out button). Added functionality and react hooks, props and styled them with styled components
  • Set up of reducers and slices
  • Stored access token in localStorage, which was saved to Redux store
  • Made use of browserrouter, provider, switch, routes
  • Displayed an error message when the validation of user input when creating a new user fails

View it live

Available paths backend

"path": "/", "methods": "GET"

"path": "/travelinspo", "methods": "GET"

"path": "/signup", "methods": "POST"

"path": "/signin", "methods": "POST"

project-auth's People

Contributors

isabellam5 avatar emolsz avatar dependabot[bot] avatar idlefingers avatar

Forkers

tobiashagberg

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.