Open
Conversation
AvtoBBus
requested changes
Apr 13, 2026
Collaborator
There was a problem hiding this comment.
Вот такие файлы в гит игнор, они генерируются после npm i
Нужны только package.json
Collaborator
There was a problem hiding this comment.
Аналогично про этот файл
| "preview": "vite preview" | ||
| }, | ||
| "dependencies": { | ||
| "axios": "^1.14.0", |
Collaborator
There was a problem hiding this comment.
не советую использовать axios
|
|
||
| <main className="main"> | ||
| <section className="card"> | ||
| <h2 className="card-title">Поиск</h2> |
Collaborator
Comment on lines
+118
to
+124
| style={{ | ||
| width: '100%', | ||
| height: '400px', | ||
| borderRadius: '12px', | ||
| marginBottom: '1rem', | ||
| border: '2px solid #e0e0e0' | ||
| }} |
Collaborator
| setLoading(true) | ||
| setError(null) | ||
| try { | ||
| const res = await fetch(`/api/rasp/route?from=${fromStation.code}&to=${toStation.code}&date=${date}`) |
Collaborator
There was a problem hiding this comment.
Вообще в вашем случае работает, но по-хорошему добавлять в начале полный url сервера, который лежит где-нибудь в .env
fetch(import.meta.env.BASE_URL + url)| app.use(cors()) | ||
| app.use(express.json()) | ||
|
|
||
| const BASE_URL = 'https://api.rasp.yandex-net.ru/v3.0' |
|
|
||
| let stationsCache = [] | ||
| let cacheTimestamp = null | ||
| const CACHE_TTL = 24 * 60 * 60 * 1000 |
Comment on lines
+96
to
+113
| if (region === 'samara') { | ||
| const SAMARA_BBOX = { | ||
| minLon: 49.5, maxLon: 51.0, | ||
| minLat: 52.8, maxLat: 53.8 | ||
| } | ||
| filtered = filtered.filter(s => | ||
| s.latitude >= SAMARA_BBOX.minLat && s.latitude <= SAMARA_BBOX.maxLat && | ||
| s.longitude >= SAMARA_BBOX.minLon && s.longitude <= SAMARA_BBOX.maxLon | ||
| ) | ||
| } | ||
|
|
||
| filtered.sort((a, b) => { | ||
| const aTitle = a.title.toLowerCase() | ||
| const bTitle = b.title.toLowerCase() | ||
| if (aTitle === 'самара' && bTitle !== 'самара') return -1 | ||
| if (bTitle === 'самара' && aTitle !== 'самара') return 1 | ||
| return aTitle.localeCompare(bTitle) | ||
| }) |
Collaborator
There was a problem hiding this comment.
Не совсем надёжная проверка на то что это станция Самарская, есть esr_code
| } | ||
| }) | ||
|
|
||
| const PORT = 3001 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Реализовано веб-приложение для поиска ЖД-станций, просмотра расписания электричек и построения маршрутов по Самарской области.