Shifts GraphQL Mesh (API Gateway)
Unify the data sources and access them through a unified GraphQL API. It's a GraphQL gateway that can be configured to fetch data from multiple sources and expose them through a single GraphQL API.
Getting Started
git clone https://gitea.friendlysquad.io/Management/shifts-graphql-mesh.git
Node Version
node -v
v19.0.1
Installation
npm install
Running the app
# development
npm run start
Port Configuration
The port can be configured in the package.json
file.
Default Port: 4000
Open http://localhost:4000/graphql (opens in a new tab) to view it in the browser.
Configuration
Change the configuration in the .meshrc.yaml
file. By default it has the following configuration:
sources:
# - name: user-permission
# handler:
# graphql:
# endpoint: http://159.69.218.15:8100/query
- name: user-account
handler:
graphql:
endpoint: http://159.69.218.15:8110/query
- name: channel
handler:
graphql:
endpoint: http://159.69.218.15:8120/query
- name: assigned-shift
handler:
graphql:
endpoint: http://159.69.218.15:8085/query
- name: open-shift
handler:
graphql:
endpoint: http://159.69.218.15:8086/query
- name: shared-schedule
handler:
graphql:
endpoint: http://159.69.218.15:9095/query
- name: shift-group
handler:
graphql:
endpoint: http://159.69.218.15:7075/query
- name: shift-group-member
handler:
graphql:
endpoint: http://159.69.218.15:7076/query
- name: day-note
handler:
graphql:
endpoint: http://159.69.218.15:7071/query
- name: request
handler:
graphql:
endpoint: http://159.69.218.15:6061/query
- name: request-swap
handler:
graphql:
endpoint: http://159.69.218.15:6062/query
- name: request-offer
handler:
graphql:
endpoint: http://159.69.218.15:6063/query
- name: request-time-off
handler:
graphql:
endpoint: http://159.69.218.15:6064/query
- name: time-off
handler:
graphql:
endpoint: http://159.69.218.15:6969/query
- name: setting
handler:
graphql:
endpoint: http://159.69.218.15:6970/query
Note: Highly recommended not to change the port of the services. If you want to change the port of the services, you need to change the port in the .env
file as well.
Run With PM2
PM2
PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
# install pm2 globally
npm install pm2 -g
# start
pm2 start --name shifts npm -- start
# restart
pm2 restart shifts
# stop
pm2 stop shifts
# delete
pm2 delete shifts
# list
pm2 list