Skip to content

gokhanozdemir/mini-twitter-x-mock-api-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini Twitter X - Mock API Server

## How to run

### Install dependencies

npm install

### Run the server

npm run api

will run the server on http://localhost:3001

When you run the server, it will console log 3 predefined users. You can use one of them to login. You can also register a new user.

You can use the following user to login:

Predefined user: {
  id: '4iqOO',
  username: 'Tatum_Schneider',
  password: 'oaZSxaOPcQfzhF6',
  email: '[email protected]',
  hashedPassword: '$2b$10$DVy/a7kxN...6BbZZh1O',
  token: 'eyJ...vd49g'
}

Endpoints & Requests:

Profile Authentication:

Method URL Desc
POST ${URL}/profile/register Register
POST ${URL}/profile/logout Logout
POST ${URL}/profile/login Login

Dynamic Documentation

Run in Postman

Tweet Management:

There urls are protected by authentication. You need to send Authorization header with Bearer <token> value.

Method URL Description
GET ${URL}/tweet/ Get All Tweets
GET ${URL}/tweet/id Get a Tweet
POST ${URL}/tweet New Tweet
PUT ${URL}/tweet/id Edit Tweet
DELETE ${URL}/tweet/id Delete Tweet
POST ${URL}/tweet/like/id Like
DELETE ${URL}/tweet/like/id Unlike
POST ${URL}/tweet/retweet/id Retweet
POST ${URL}/tweet/reply/id Comment
DELETE ${URL}/tweet/reply/id Delete Comment

Dynamic Documentation

Run in Postman

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%