Skip to content

hasadna/open-bus-backend

Repository files navigation

🚌 Open Bus Backend

A backend service powering the Open-Bus platform. Provides APIs for health checks, GitHub issue creation, complaints, and government transportation data.

📢 Get Involved

📖 API Documentation

🔗 Related Projects

⚙️ Installation

npm install

🌍 Environment Variables

Create a .env file:

# Server Configuration
PORT=3001
HOST=0.0.0.0
NODE_ENV=development
LOG_LEVEL=info

# GitHub Configuration
GITHUB_TOKEN=your_github_token
GITHUB_OWNER=your_github_username
GITHUB_REPO=your_repository_name

🚀 Running the Server

Development

npm run dev

Production

npm start

🧪 Testing

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Run lint checks
npm run test:lint

# Fix lint issues
npm run lint:fix

🐳 Running with Docker

  1. Build the image
docker build -t open-bus-backend .
  1. Run the container
docker run -it -p 3001:3001 \
  -e GITHUB_TOKEN=your_github_token \
  -e GITHUB_OWNER=your_github_owner \
  -e GITHUB_REPO=your_github_repo \
  -e LOG_LEVEL=info \
  open-bus-backend

🔗 API Endpoints

🩺 Health Check

  • GET / → Returns server status

🐞 GitHub Issues

  • POST /issues → Create a new GitHub issue
    • Required: title, contactName, contactEmail, description, environment, expectedBehavior, actualBehavior, reproducibility
    • Optional: attachments[] (array of URLs)

📣 Complaints

  • POST /complaints → Submit a complaint to government forms
    • Required:

      • userData: firstName, lastName, id, email, phone
      • databusData: operator
    • Optional: debug, complaintType, description

🏛️ Government Transportation

Endpoint Method Required Body
/gov/lines-by-station POST EventDate, OperatorId, StationId
/gov/stations-by-line POST eventDate, OperatorId, OfficelineId, Directions
/gov/subjects POST listName = "subject_type_vehicles"
/gov/train-stations POST StationTypeId
/gov/pniya POST listName = "pniya"
/gov/not-real-numbers POST listName = "notrealnumbers"
/gov/lines-by-line POST eventDate, OperatorId, OperatorLineId
/gov/cities POST none
/gov/time GET none

Server will be available at: http://localhost:3001

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 5