mysql -u root -p
create database socializedb;
create user SocializeAdmin identified with mysql_native_password by 'wrong_password';
grant all privileges on socializedb.* to SocializeAdmin;
flush privileges;
use socializedb;
./src
├───controllers # functions to connect routes to db operations
├───db # db connection and model definitions
├───public # html/css/js files for static part of the site
├───routes # express middlewares (route wise)
└───utils # Generate Random username
src/public
├───app # our own common frontend js and CSS code
├───components # our own html snippets
├───css # CSS library used
├───js # JavaScript libraries used
└───index.html # First / Home page
- create users this will create a new user with a random username
-
create posts this will create a new post, required fields are
- username (the author of that post)
- title (the title of the post)
- body
-
show all posts list all existing posts, we should have following filtering support*
- filter by username
- filter by query contained in title (search by title)
-
show current user's posts list all existing posts created by current user, we should have following filtering support*
- filter by username
- filter by query contained in title (search by title)
-
show post by postId Expand post by postId in full page upon clicking on ...see more, we should have following filtering support*
- filter by username
- filter by query contained in title (search by title)
-
edit posts
TBD
-
delete posts
TBD
-
add a comment
-
show all comments (under a post)
-
show all comments (of a user)
NOTE: Access database through controllers not routes & controllers through routes!
-
POST /users
-- Creates a new user with random username and user id -
GET /users/{userid}
-- Get a user with a given user id -
GET /users/{username}
-- Get a user with a given username
-
GET /posts
-- Get all posts by everyone -
GET /posts/:postId
-- Get post by its post id -
POST /posts
-- Create a new post. required fields in body are:
userId=
title=
body=
git init
git add .
# setup user email and name for author if not already
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git commit -sm "commit message"