segokuning-social-app

module
v0.0.0-...-ebd03d0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: MIT

README

citadel-corp/segokuning-social-app

I'm Commander Shepard, and This Is My Favorite 'Social App Service' on the Citadel

🔍 Tested with this k6 script.

📝 Documentation - TBA.

🎵 Songs to test by - playlist.

Getting Started

These instructions will give you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on deploying the project on a live system.

Prerequisites

Requirements for the software and other tools to run and test

Note that we use AWS S3 service to upload image, setup your own S3 bucket if you want to test uploading image.

Migrate the database

After setting up your database locally, run this to migrate our database structure

$ migrate -source file://path/to/migrations -database postgres://localhost:5432/database up 2
Running the service

A step by step series of that tell you how to get a development environment running

Create file named .env and fill it with, example:

DB_HOST = localhost
DB_PORT = 5432
DB_USERNAME = root
DB_PASSWORD = pass12345
DB_NAME = segokuning
DB_PARAMS = "&sslmode=disable"
BCRYPT_SALT = 12
JWT_SECRET = ${JWT_SECRET}
S3_ID = ${S3_ID}
S3_SECRET_KEY = ${S3_SECRET_KEY}
S3_BUCKET_NAME = ${S3_BUCKET_NAME}
S3_REGION = ${S3_REGION}
ENV = local

Run the service

go run cmd/main.go

Now you can run the service. Service is running on port 8080.

Endpoints

  • User
    • Register - POST /v1/user/register
    • Login - POST /v1/user/login
    • Link Email - POST /v1/user/link
    • Link Email - POST /v1/user/link/email
    • Link Phone - POST /v1/user/link/phone
    • Update - PATCH /v1/user
  • Friends
    • Add - POST /v1/friend
    • Remove - DELETE /v1/friend
    • List - GET /v1/friend
  • Post
    • Create - POST /v1/post
    • List - GET /v1/post
    • Comment - POST /v1/post/comment
  • Image
    • Upload - POST /v1/image

Running the tests

First, run our service.

After installing k6, clone this test script outside of this project directory, and then run:

$ BASE_URL=http://localhost:8080 k6 run script.js

To run with certain number of iterations and virtual users:

$ BASE_URL=http://localhost:8080 k6 run -i NUMBER_OF_ITERATIONS --vus NUMBER_OF_VIRTUAL_USERS script.js

To run with real world cases:

BASE_URL=http://localhost:8080 REAL_WORLD_CASE=true k6 run -i NUMBER_OF_ITERATIONS --vus NUMBER_OF_VIRTUAL_USERS script.js

Authors

The Citadel Corp team:

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • The Ramadhan ProjectSprint organizer and members

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL