Skip to content

BetterSocial/user-api

Repository files navigation

user-api

User Services API

Get Started

  • After clone the project
  • Install dependency by running
npm install
  • Run the app
npm run dev

Testing

Prerequisite

  1. set EXECUTABLE_PHP environment variable in .env file. you can run which php in your console to find it
EXECUTABLE_PHP=/path/to/bin/php
  1. set LARAVEL_PATH environment variable in .env file. need to set fullpath to your laravel project that contain migration
LARAVEL_PATH=/path/to/laravel
  1. you need to create database named "testing" in your Postgresdb
  2. open .env.test file. If you don't have this .env.test file, copy paste from .env
  3. Change these value in .env.test
DB_HOST=localhost
DB_NAME=testing
DB_PASSWORD=<your-postgresql-password>
DB_USERNAME=<your-postgresql-username>
// Add this value if you copy from .env file
DB_SSL=false

Running Test

  1. To run api (integration) testing
npm run test:api

Running with docker

  • make sure you already have .env file (can see the .env.example for some connection to docker services)

Prerequisite

  • Docker
  • Docker compose

Whats in docker-compose.yml

Commands

  1. Start docker-compose
docker-compose up -d
  1. getting into user-api bash console
docker-compose exec user-api bash