https://github.com/ericthomasca/star-trek-api
https://github.com/ericthomasca/star-trek-api
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ericthomasca/star-trek-api
- Owner: ericthomasca
- License: mit
- Created: 2024-08-16T23:33:29.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-27T22:52:49.000Z (almost 2 years ago)
- Last Synced: 2025-10-04T23:01:22.684Z (9 months ago)
- Language: Go
- Homepage:
- Size: 50.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Star Trek Database
[](https://pkg.go.dev/github.com/ericthomasca/star-trek-api)
This project provides a database for Star Trek series and episodes. It includes functionality to seed the database with data from JSON files.
## Project Structure
```
star-trek-api/
│
├── config/
│ └── config.go # Configuration settings
│
├── data/
│ ├── data.go # General data handling
│ ├── ds9.go # Data for Deep Space Nine
│ ├── ent.go # Data for Enterprise
│ ├── tas.go # Data for The Animated Series
│ ├── tng.go # Data for The Next Generation
│ ├── tos.go # Data for The Original Series
│ └── voy.go # Data for Voyager
│
├── models/
│ └── models.go # Database models
|
├── seed/
│ └── seed.go # Database seeding logic
|
├── go.mod # Go module file
├── go.sum # Go module checksum file
├── LICENSE # Project license
├── main.go # Main application entry point
├── README.md # Project documentation
└── star-trek-api # Executable binary (if built)
```
## Setup
### Prerequisites
- Go (1.22+)
- PostgreSQL
### Installation
1. **Clone the repository:**
```sh
git clone https://github.com/yourusername/star-trek-database.git
cd star-trek-database
```
2. **Install dependencies:**
```sh
go mod tidy
```
3. **Create a `.env` file:**
Rename `.env.example` to `.env` and edit it with your PostgreSQL credentials:
```env
DB_HOST=localhost
DB_USER=yourusername
DB_PASS=yourpassword
DB_NAME=yourdbname
DB_PORT=5432
```
4. **Prepare the database:**
Ensure PostgreSQL is running and the database exists.
### Running the Application
To seed the database, run:
```sh
go run main.go
```
This will:
- Drop existing tables
- Recreate tables
- Seed the database with data from `data/` files
## Data Files
- **`data/data.go`**: General data handling functions.
- **`data/ds9.go`**: Data for Deep Space Nine.
- **`data/ent.go`**: Data for Enterprise.
- **`data/tas.go`**: Data for The Animated Series.
- **`data/tng.go`**: Data for The Next Generation.
- **`data/tos.go`**: Data for The Original Series.
- **`data/voy.go`**: Data for Voyager.
## License
MIT License.
## Contact
For questions, contact [eric@ericthomas.ca](eric@ericthomas.ca).
---
Feel free to replace placeholders with actual information specific to your project.