Skip to content

Instantly share code, notes, and snippets.

View umairian's full-sized avatar
🎯
Focusing

Umair Syed umairian

🎯
Focusing
View GitHub Profile
@umairian
umairian / readme.md
Last active November 21, 2023 07:21
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 use