Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3283ed3

Browse files
authored
Merge pull request #15 from headlines-toolkit/feature_document_database_migration
Feature document database migration
2 parents 5d559e2 + b2b4363 commit 3283ed3

File tree

15 files changed

+612
-1225
lines changed

15 files changed

+612
-1225
lines changed

‎.env ‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This is an example environment file.
2+
# Copy this file to .env and fill in your actual configuration values.
3+
# The .env file is ignored by Git and should NOT be committed.
4+
5+
# DATABASE_URL="mongodb://user:password@localhost:27017/ht_api_db"
6+
DATABASE_URL="mongodb://localhost:27017/ht_api_db"

‎.env.example‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Copy this file to .env and fill in your actual configuration values.
33
# The .env file is ignored by Git and should NOT be committed.
44

5-
DATABASE_URL="postgres://user:password@localhost:5432/db_name"
5+
DATABASE_URL="mongodb://user:password@localhost:27017/ht_api_db"

‎README.md‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ management dashboard](https://github.com/headlines-toolkit/ht-dashboard).
4242
behavior—including ad frequency, feature flags, and maintenance status—without
4343
requiring a client-side update.
4444

45-
* 💾 **Robust Data Management:** Securely manage core news data (headlines,
46-
topics, sources) through a well-structured API that supports flexible
47-
querying and sorting for dynamic content presentation.
48-
4945
* 📊 **Dynamic Dashboard Summary:** Access real-time, aggregated metrics on
5046
key data points like total headlines, topics, and sources, providing
5147
an at-a-glance overview for administrative dashboards.
@@ -75,7 +71,7 @@ for more details.
7571

7672
1. **Prerequisites:**
7773
* Dart SDK (`>=3.0.0`)
78-
* PostgreSQL (`>=14.0` recommended)
74+
* MongoDB (`>=5.0` recommended)
7975
* Dart Frog CLI (`dart pub global activate dart_frog_cli`)
8076

8177
2. **Configuration:**
@@ -85,7 +81,7 @@ for more details.
8581
Create a `.env` file in the root of the project or export the variable in
8682
your shell:
8783
```
88-
DATABASE_URL="postgres://user:password@localhost:5432/ht_api_db"
84+
DATABASE_URL="mongodb://user:password@localhost:27017/ht_api_db"
8985
```
9086
9187
3. **Clone the repository:**
@@ -101,11 +97,10 @@ for more details.
10197
```bash
10298
dart_frog dev
10399
```
104-
The API will typically be available at `http://localhost:8080`. On the
105-
first startup, the server will connect to your PostgreSQL database, create the
106-
necessary tables, and seed them with initial fixture data. This process is
107-
non-destructive; it uses `CREATE TABLE IF NOT EXISTS` and `INSERT ... ON
108-
CONFLICT DO NOTHING` to avoid overwriting existing tables or data.
100+
The API will typically be available at `http://localhost:8080`. On startup,
101+
the server will connect to your MongoDB database and seed it with initial
102+
fixture data. This seeding process is idempotent (using `upsert`
103+
operations), so it can be run multiple times without creating duplicates.
109104
110105
111106
**Note on Web Client Integration (CORS):** To allow web applications (like

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /