Skip to content

E-Contractor/api-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Gateway

The front door for the backend. Every request from the web app comes in here on port 3000, and the gateway forwards it to whichever service owns it. A few routes are aggregated instead of just proxied: the gateway calls two or three services and merges the results, so login can return the user and their profile in a single response.

  • Port: 3000
  • Base URL: http://localhost:3000/api

What it routes

Prefix Service
/api/auth auth-service
/api/profiles profile-service
/api/opportunities opportunity-service
/api/bids, /api/proposals, /api/notifications, /api/messages bid-service
/api/files file-service
/api/ratings rating-service

It also terminates the WebSocket connection for realtime notifications and exposes an internal /internal/emit endpoint that the other services call to push events out to connected clients.

Running

npm install
npm run dev     # live reload
npm run build   # compile to dist/
npm start       # run the compiled build

Environment (.env)

PORT=3000
FRONTEND_URL=http://localhost:5173
SERVICE_AUTH_SECRET=<shared with all services>
JWT_ACCESS_SECRET=<shared with all services>

AUTH_SERVICE_URL=http://localhost:3001
PROFILE_SERVICE_URL=http://localhost:3002
OPPORTUNITY_SERVICE_URL=http://localhost:3003
BID_SERVICE_URL=http://localhost:3004
FILE_SERVICE_URL=http://localhost:3005
RATING_SERVICE_URL=http://localhost:3006

For the full list of which endpoints are aggregated and which are proxied straight through, see ../ARCHITECTURE_EXPLANATION.md.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages