Skip to content

Instantly share code, notes, and snippets.

@haroonkhan9426
Forked from umairian/readme.md
Created May 12, 2022 08:31
Show Gist options
  • Save haroonkhan9426/2bbb9a3324e39250d31e6ee59ec61b7c to your computer and use it in GitHub Desktop.
Save haroonkhan9426/2bbb9a3324e39250d31e6ee59ec61b7c to your computer and use it in GitHub Desktop.
AntonX Node (Express) Task

Build A Small Ecommerce App - AntonX Full Stack Task

Backend Technologies to be Used

Express and Sequelize (MySQL)

Backend Requirements

  1. Make two tables users and shops via migrations in the database.
  2. users table must contain name, email, password(must be hashed), role(ENUM type having User, Admin values), createdAt and updatedAt fields.
  3. While shops table must contain name, description, fk_user_id(foreign key of users table), address, createdAt, and updatedAt fields.
  4. There should be one to many relationship between users and shops.i.e. one user can have multiple shops.
  5. You have to make three APIs.
  6. First, you need to create login endpoint. The route will be POST: api/users/login, which will return jwt token and the user data the provided credentials are correct.
  7. Second, create shop API by creating POST: api/users/:userId/shops route. Make sure to add middleware to authenticate the user via token.
  8. Third, Only Admin can get all users with their shops included by creating GET: api/users route that would return all users in the users table.
  9. Use async/await, not promises and thenables.

Frontend Technologies to be used

React and Redux

Frontend Requirements

  1. Integrate the login API mentioned above and redirect the user to an admin dashboard (any theme of your choice) if the credentials are correct. Apply all the frontend validations on input fields.
  2. On the left sidebar, there would be two options, Home and Shops.
  3. In Home Screen, Show a greeting message with the name of the user included.
  4. In Shops Screen, Show all shops of the user in cards (Third API Integration) and on top right a button of Create new Shop would redirect the user to a form to create a new shop (Second API Integration).

Good Luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment