Skip to content

Commit

Permalink
feat(docs): public transport endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
krystxf committed Jul 13, 2024
1 parent 3e72af8 commit eb1c269
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 60 deletions.
59 changes: 4 additions & 55 deletions docs/src/pages/docs/backend.mdx
Original file line number Diff line number Diff line change
@@ -1,60 +1,9 @@
# Backend

[source code](https://github.com/krystxf/metro-now/tree/main/backend)
[source code](https://github.com/krystxf/metro-now/tree/main/backend-nest)

Lightweight backend that provides data from [Golemio API](https://api.golemio.cz/pid/docs/openapi/#/%F0%9F%9A%8F%20PID%20Departure%20Boards/get_pid_departureboards).
Wrapper for [Golemio API](https://api.golemio.cz/pid/docs/openapi/#/%F0%9F%9A%8F%20PID%20Departure%20Boards/get_pid_departureboards) built with [NestJS](https://nestjs.com/)

## Technologies
## Setup

### V1

built with [Bun](https://github.com/oven-sh/bun)

- [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) endpoint

**Setup**

```bash
# Clone the repository
git clone https://github.com/krystxf/metro-now.git

# Open the backend directory
cd metro-now/backend/v1

# Install dependencies
bun install

# Create a .env file
cp .env.example .env

# Edit the .env files with your own values

# Start the backend
bun start
```

### V2

built with [Express.js](https://expressjs.com/)

- REST endpoint
**Setup**

```bash
# Clone the repository
git clone https://github.com/krystxf/metro-now.git

# Open the backend directory
cd metro-now/backend/v2

# Install dependencies
pnpm install

# Create a .env file
cp .env.example .env

# Edit the .env files with your own values

# Start the backend
pnpm run dev
```
see instructions in the [README](https://github.com/krystxf/metro-now/blob/main/backend-nest/README.md)
21 changes: 18 additions & 3 deletions docs/src/pages/docs/rest-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ Backend gets data from [Golemio API](https://api.golemio.cz/pid/docs/openapi/) c

<br />

<a href="https://api.metronow.dev/metro?station=andel" target="_blank">
```http GET https://api.metronow.dev/metro ```
</a>
```http
GET https://api.metronow.dev/metro?station=andel
```

### Query parameters

#### `station` or `platform` (required)
Expand Down Expand Up @@ -188,3 +189,17 @@ GET https://api.metronow.dev/metro?station=["Anděl","Dejvická"]
<li>Zličí</li>
<li>Želivského</li>
</details>

## Public transport stops

### Get all stops

```http
GET https://api.metronow.dev/stop/all
```

## Get stops inside bounding box

```http
GET https://api.metronow.dev/stop?latitude=[48,52]&longitude=[14,15]
```
9 changes: 7 additions & 2 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@
"paths": {
"@/*": ["./src/*"]
},
"strictNullChecks": true
"strictNullChecks": true,
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"noEmit": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"src/pages/terms-and-condition.mdx"
]
],
"exclude": ["node_modules"]
}

0 comments on commit eb1c269

Please sign in to comment.