Template
README po polsku
This commit is contained in:
@@ -1,35 +1,34 @@
|
|||||||
# ElysiaJS Boilerplate
|
# ElysiaJS Boilerplate
|
||||||
|
|
||||||
Starter for the ElysiaJS coursework workspace: Bun + ElysiaJS + TypeScript,
|
Szablon startowy do zajęć z ElysiaJS: Bun + ElysiaJS + TypeScript, z
|
||||||
with MySQL (Drizzle ORM) and Redis wired up to the shared course databases.
|
podpiętym MySQL (Drizzle ORM) i Redisem do wspólnych baz danych z kursu.
|
||||||
|
|
||||||
## Development
|
## Uruchomienie
|
||||||
```bash
|
```bash
|
||||||
bun install
|
bun install
|
||||||
bun run db:push # creates the `notes` table from src/db/schema.ts
|
bun run db:push # tworzy tabelę `notes` z src/db/schema.ts
|
||||||
bun run dev
|
bun run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Open http://localhost:3000/swagger for interactive API docs (auto-generated
|
Wejdź na http://localhost:3000/swagger - tam znajdziesz dokumentację API
|
||||||
from the routes in `src/index.ts`).
|
(generowaną automatycznie z endpointów w `src/index.ts`).
|
||||||
|
|
||||||
## What's here
|
## Co tu jest
|
||||||
- `src/index.ts` - the app: a couple of example routes showing MySQL reads/
|
- `src/index.ts` - główna aplikacja: przykładowe endpointy pokazujące odczyt
|
||||||
writes via `src/db` and Redis reads/writes via `src/redis.ts`. Delete the
|
i zapis do MySQL (`src/db`) oraz do Redisa (`src/redis.ts`). Usuń te
|
||||||
examples once you understand the pattern and start building your own.
|
przykłady, gdy zrozumiesz zasadę działania i zaczniesz pisać własny kod.
|
||||||
- `src/db/schema.ts` - your Drizzle table definitions. Add tables here, then
|
- `src/db/schema.ts` - definicje tabel w Drizzle. Dodawaj tu kolejne tabele,
|
||||||
run `bun run db:push` to sync them to MySQL (no migration files needed for
|
a potem uruchom `bun run db:push`, żeby zsynchronizować je z bazą MySQL
|
||||||
coursework - `push` just diffs your schema against the live database).
|
(bez plików migracji - `push` po prostu porównuje schemat z bazą na żywo).
|
||||||
- `src/db/index.ts` / `src/redis.ts` - pre-configured clients, reading
|
- `src/db/index.ts` / `src/redis.ts` - gotowe klienty, które czytają dane
|
||||||
connection details from environment variables. In your Coder workspace
|
połączenia ze zmiennych środowiskowych. W Twoim workspace w Coderze są one
|
||||||
these are already set for you (`MYSQL_*`, `REDIS_*`) - you never need to
|
już ustawione (`MYSQL_*`, `REDIS_*`) - nie musisz nigdzie wpisywać hasła.
|
||||||
type a password into code.
|
- `.env.example` - potrzebne tylko, jeśli chcesz uruchomić projekt poza
|
||||||
- `.env.example` - only needed if you want to run this outside your Coder
|
workspace'em w Coderze, na własnym MySQL/Redis.
|
||||||
workspace, against your own local MySQL/Redis.
|
|
||||||
|
|
||||||
## Notes
|
## Uwagi
|
||||||
- Your Redis user can only touch keys under `student:<your-username>:*`
|
- Twój użytkownik Redis widzi tylko klucze pod `student:<twoja-nazwa>:*`
|
||||||
(enforced by the server) - that's why `src/index.ts` prefixes cache keys
|
(wymuszone po stronie serwera) - dlatego `src/index.ts` dodaje ten prefiks
|
||||||
with `REDIS_USERNAME`. Keys outside that prefix will be rejected.
|
do kluczy w cache. Klucze spoza tego prefiksu zostaną odrzucone.
|
||||||
- Your MySQL user only has access to your own database - no need to specify
|
- Twój użytkownik MySQL ma dostęp tylko do swojej własnej bazy - nie musisz
|
||||||
it beyond what's already in `MYSQL_DATABASE`.
|
nic dodatkowo podawać poza tym, co jest już w `MYSQL_DATABASE`.
|
||||||
|
|||||||
Reference in New Issue
Block a user