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) |
Users (@front-stage)
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 |
Admins (@back-stage)
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 |
- Clone the repository to your computer
git clone -b master git@github.com:jadokao/twitter-api-2020.git
- Init: install the npm packages
cd twitter-api-2020
npm install
- 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.
- Direct to ./config/config.json, and modify "username" & "password" in "development" section to map your local Sequelize setting.
- Setup local database at SQL Workbench
drop database if exists ac_twitter_workspace;
create database ac_twitter_workspace;
- Create data in locl database
npx sequelize db:migrate
npx sequelize db:seed:all
- Run the project
npm run dev
- 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.
- github:https://github.com/sh330035/twitter-frontend
- website:https://sh330035.github.io/twitter-frontend/