This app is a social tool modeled after Instagram, allowing users to post text updates in the feed and engage with posts by giving likes.
This app have users and posts related each other.
The application is a social networking platform focused on facilitating post sharing and interaction among users. Users have the ability to create posts, edit their own posts, and engage with posts created by other users by liking or disliking them. Additionally, users can explore a feed of posts from other users, providing a space for communication and expression within the community.
https://hi-its-me-dev-sjmz.2.sg-1.fl0.io
- Initial steps to run the proyect
- Clone de repository
- Install dependencies
$ npm install
- Create a container in Docker with your credentials.
- Create the .env file and define your personal credentials to run the project.
- Run de seeder:
$ npm run seed
- Initialize API
$ npm run dev
$ npm init --yes
$ npm i express
$ npm i nodemon -D
$ npm dotenv -E
$ npm i mongoose -E
- installation Git
$ git init
- Add type module to do import and export (avoid use "requires")
//(on package.json)
//write before scripts:
{
"type":"module"
}
npm i mongoose
Auth endpoints
User endpoints
Post endpoints
user/admin/superadmin
{
_id:"65f08bf319ed20287fd19c3a",
name: "super_admin",
email: "super_admin@super_admin.com",
password: await bcrypt.hash("123456" , 8 ),
role: "super_admin"
},
{
_id: "65f08bf319ed20287fd19c3b",
name: "admin",
email: "[email protected]",
password: await bcrypt.hash("123456" , 8 ),
role: "admin"
},
{
_id:"65f08bf319ed20287fd19c3c",
name: "user",
email: "[email protected]",
password: await bcrypt.hash("123456" , 8 ),
role: "user"
}
posts
{
_id: "65f08bf319ed20287fd19c56",
title: "el tituloooo",
text: "Conscendo addo venia ubi ciminatio utpote uredo auctor cursus. Cometes…",
nick: "65f08bf319ed20287fd19c3c"
},
{
_id: "65f08bf319ed20287fd19c55",
title: "el tituloooo2",
text: "Conscendo addo venia ubi ciminatio utpote uredo auctor cursus. Cometes…",
nick: "65f08bf319ed20287fd19c3c"
},
{
_id: "65f08bf319ed20287fd19c54",
title: "el tituloooo3",
text: "Conscendo addo venia ubi ciminatio utpote uredo auctor cursus. Cometes…",
nick: "65f08bf319ed20287fd19c3c"
}
POST https://hi-its-me-dev-sjmz.2.sg-1.fl0.io/api/auth/register
{
"email": "[email protected]",
"password":"123456"
}
POST https://hi-its-me-dev-sjmz.2.sg-1.fl0.io/api/auth/login
{
"email":"[email protected]",
"password":"123456"
}
GET https://hi-its-me-dev-sjmz.2.sg-1.fl0.io/api/users/
GET https://hi-its-me-dev-sjmz.2.sg-1.fl0.io/api/users/profile
//write this on body
{
"email": "[email protected]",
"password":"123456"
}
DELETE https://hi-its-me-dev-sjmz.2.sg-1.fl0.io/api/posts/:id
- Delete a post by id.
- It is only allowed for the owner of the post.
- Add User's token on Auth/Bearer.
PUT https://hi-its-me-dev-sjmz.2.sg-1.fl0.io/api/posts/:id
//write this on body
{
"title": "feliz navidad"
}
GET https://hi-its-me-dev-sjmz.2.sg-1.fl0.io/api/posts/own
- Add User's token on Auth/Bearer.
GET https://hi-its-me-dev-sjmz.2.sg-1.fl0.io/api/posts
- Add a token in Auth/Bearer because the watcher should be logged.
GET https://hi-its-me-dev-sjmz.2.sg-1.fl0.io/api/posts/:id
- Add a token in Auth/Bearer because the watcher should be logged.
- Add postId in the request to find it.
PUT https://hi-its-me-dev-sjmz.2.sg-1.fl0.io/api/posts/like/:id
bug This only worked if you write true on body because the "botton: like" should be "pressedON" to allow the likes acount change true/false and show whose liked the post. SOLVED deleting like param.
- I tried to add "name" parameter in body of users. But this hasnt control if name is different because in model is not required..
- Added 3 posts and 3 users default for some functionalities.
Thanks all for helping and support my progress in this proyect.