Skip to content

A simple Twitter API project built with Node.js, Express.js and MySQL, and collaborated with Front-end partners, Dolly & David, and Back-end partner, Ming.

Notifications You must be signed in to change notification settings

wentingliuu/twitter-api-2020

 
 

Repository files navigation

Simple Twitter API

A simple Twitter API project built with Node.js, Express.js and MySQL, and collaborated with Front-end partners, Dolly & David, and Back-end partner, Ming. Featuring like Twitter, users could post/reply/like posts, follow/unfollow others, edit their own profile including profile phote and cover photo.

🌟 Mainly responsible for Back-end, such as design & create database using MySQL, develop RESTful API for front-end partenr to fetch data, depoly API to cloud application platform HEROKU.

🌟 Project introduction written on Medium (in Chinese).

🌟 Click Here and use the following dummy data to have a try.

Account Password Role
user1 12345678 User (access to front-stage)
root 12345678 Admin (access to back-stage)

Features

Feature API ROUTE
REGISTER POST /users
LOGIN POST /signin
LOGOUT -
GET TOP 10 USERS GET /users/top
USER INFO (Tweet List) GET /users/:id/tweets
USER INFO (Reply List) GET /users/:id/replied_tweets
USER INFO (Like List) GET /users/:id/likes
USER INFO (Following List) GET /users/:id/followings
USER INFO (Follower List) GET /users/:id/followers
GET USER PROFILE GET /users/:id
EDIT USER PROFILE PUT /users/:id
EDIT USER SETTING PUT /users/:id/setting
FOLLOW OTHERS POST /followships
UNFOLLOW OTHERS DELETE /followships/:followingId
CREAT A POST POST /tweets
READ ALL POSTS GET /tweets
READ A POST GET /tweets/:tweet_id
READ REPLIES OF A POST GET /tweets/:tweet_id/replies
CREAT NEW REPLY TO A POST POST /tweets/:tweet_id/replies
LIKE A POST POST /tweets/:tweet_id/like
UNLIKE A POST POST /tweets/:tweet_id/unlike
Feature API ROUTE
LOGIN POST /admin/signin
LOGOUT -
GET FULL USER LIST GET /admin/users
GET FULL TWEET LIST GET /admin/tweets
DELETE SPECIFIC TWEET DLETE /admin/tweets/:id

Screenshots

FRONT-STAGE

Front stage

BACK-STAGE

Back stage

Installation and Execution

  1. Clone the repository to your computer
git clone -b master git@github.com:jadokao/twitter-api-2020.git
  1. Init: install the npm packages
cd twitter-api-2020
npm install
  1. Create .env file and store API Key in the file
touch .env
  • Please see .env.example for reference.
  • Please get your own IMGUR_CLIENT_ID from Imgur.
  1. Direct to ./config/config.json, and modify "username" & "password" in "development" section to map your local Sequelize setting.
  2. Setup local database at SQL Workbench
drop database if exists ac_twitter_workspace;
create database ac_twitter_workspace;
  1. Create data in locl database
npx sequelize db:migrate
npx sequelize db:seed:all
  1. Run the project
npm run dev

Skills & Tools

  • Node.js & npm - JavaScript runtime environment
  • Express.js - web application framework
  • Express-Handlebars - template engine
  • MySQL - relational database management system
  • Sequelize - a Node.js ORM tool for MySQL
  • passport-jwt - authentication middleware for Node.js
  • multer - middleware for uploading files
  • imgur - middleware for uploading images to imgur
  • Git control - to collaborate with other teammates.

LINKS

FRONT-END
BACK-END

Authurs

About

A simple Twitter API project built with Node.js, Express.js and MySQL, and collaborated with Front-end partners, Dolly & David, and Back-end partner, Ming.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%