Geegeety (Generasi GIGIH Tweety) — A Twitter-like social media for #GenerasiGIGIH.
END OF LIFE
Unit Tests: 100% (58 examples, 0 failures)
Code Coverage: 100% (24 files in total, 811 relevant lines, 811 lines covered, 0 lines missed)
#GenerasiGIGIH students need a brand new, private social media for sharing information with others.
This will be an API only social media, so there's no GUI for it.
This API must be able to provide the following features, where:
- User able to store their username, email, and bio description.
- User able to create a post that might contain hashtag(s).
- User able to see all posts that contain a certain hashtag.
- User able to see the list of trending hashtags (top 5 posted hashtags in the past 24 hours).
- User able to comment on a post that also might contain hashtag(s).
- User able to attach things to a post.
- Ruby
- MySQL/MariaDB
- Postman
- mysql2
- rack-test
- rspec
- simplecov
- sinatra
- thin
-
Make sure all requirements are installed.
$ ruby --version # 3.0.1 $ gem --version # 3.2.15 $ bundle --version # 2.2.15 $ mysql --version # 15.1 $ which postman # /usr/bin/postman
-
Clone this repository to your desired location.
$ git clone https://github.com/rgxcp/geegeety.git
-
Change your directory into the project.
$ cd geegeety
-
Install the Gem dependencies.
$ bundle install
-
Create a new database.
$ mysql -u `your-username` -p $ CREATE DATABASE geegeety_db; $ exit
-
Import the provided database schema.
$ mysql -u `your-username` -p geegeety_db < app/migration/geegeety_db.sql
-
Copy the provided
.env.example
file to.env
.$ cp .env.example .env
-
Change the
.env
file according to your machine setup.# .env export APP_ENV="development" export GEEGEETY_HOST="localhost" export GEEGEETY_USERNAME="your-username" export GEEGEETY_PASSWORD="your-password" export GEEGEETY_DATABASE="geegeety_db"
-
Load the
.env
file to your environment variables.$ source .env
-
Run the server.
$ rackup -p 4567 # accessible through http://localhost:4567
In case the above command doesn't work, run the following command:
$ bundle exec rackup -p 4567 # accessible through http://localhost:4567
-
Hit the API endpoints using Postman and do-what-you-want-with-it!
-
Make sure:
- All requirements are installed.
- All Gem dependencies are installed.
- You're in the root project folder.
-
Run the following command:
$ rspec -fd
In case the above command doesn't work, run the following command:
$ bundle exec rspec -fd
- Make sure the app is running properly in your local.
- Import the
Geegeety.postman_collection.json
file to Postman. - Click the
Run
button inside theGeegeety
collection folder in Postman.
Method | URL | Params (Body) | Description |
---|---|---|---|
GET | /api/v1/hashtags/trending |
|
Get trending hashtags |
GET | /api/v1/hashtags/:name/posts |
|
Get posts from a hashtag |
POST | /api/v1/users |
|
Create a new user |
POST | /api/v1/posts |
|
Create a new post |
POST | /api/v1/posts/:post_id/comments |
|
Create a new comment |