Skip to content

Marlos-Rodriguez/Twitter-Clon-Back

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitter Clon with Go

This is a Twitter Clon Back-End with Go and MongoDB. Make Users, Tweets and follow others users.

Instalation

Download the code and add a .env file with:

  • PORT Port for API
  • DATABASE_URL MongoDB URL
  • SECRECT_KEY Secret password for JWT

execute go mod download to download the packages and run go run main.go

Paths

User Routes
  • POST /registro - Register User Body:
{
    "email": "[email protected]",
    "password": "*******",
    "nombre": "Nombre",
    "apellidos": "Apellido",
    "fechaNacimiento": "1970-06-30T00:00:00Z"
}
  • POST /login - Login User Body:
{
    "email": "[email protected]",
    "password": "*******"
}

All the next routes require a JWT in the header, like this: Authorization: Bearer token

  • GET /profile?id=ID - Get Profile Info
  • PUT /modifyProfile - Modify Profile Body:
{
    "nombre": "nombre",
    "apellidos": "apellido",
    "biografia": "Biografia",
    "ubicacion": "Ciudad, Pais",
    "sitioWeb": "www.sitioweb.com",
    "fechaNacimiento": "1970-06-30T00:00:00Z"
}
Relation Routes
  • POST /createRelation?id=ID - Create relation with other User
  • DELETE /deleteRelation?id=ID - Deleted relation with other User
  • GET /requestRelation?id=ID - Return if exits relation with that user
  • GET /listUsers?type=follow&page=1&search=something - Get all users
    • type: follow return all the users related. new return will not
    • page: is the batch of users that returns (batch of 20)
    • search: This is optional search for something with that character

Tweet Route

  • POST /tweet - Create a Tweet Body:
{
    "message": "message"
}
  • GET /readTweet?id=ID&page=1 - return all tweets of one user
    • page is the batch of tweets that returns (batch of 20)
  • DELETE /deleteTweet?id=ID - Delete a tweet
  • GET /mainTweets?page=1 - returns the main tweets of the following people
    • page is the batch of tweets that returns (batch of 20)

Image Route

  • POST /uploadAvatar - Upload the user avatar must be send a image in a form data with name avatar
  • POST /uploadBanner - Upload the user avatar must be send a image in a form data with name banner

Releases

No releases published

Packages

No packages published

Languages