Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
afae926
Started the backend filestructure and set up
alexajah Oct 1, 2026
0697d78
Started the backend setup
alexajah Oct 1, 2026
fb21afc
Added test server format to test it works
alexajah Oct 5, 2026
885f75b
Connected the plantCard to the example data for testing the set-up
alexajah Oct 5, 2026
45184b4
Connected the backend to the MongoDB on the VM and made a simple Read…
alexajah Oct 5, 2026
6dc65cc
Made a script to load the data into the MongoDB from PERENUAL API and…
alexajah Oct 5, 2026
a9360ff
Connected the server layer to the DB by adding queries and implemente…
alexajah Oct 5, 2026
89d7e14
Added transaltions for the plant matching website
alexajah Oct 5, 2026
11d2632
Added styling to plant card, transaltions and fixed name of file
alexajah Oct 5, 2026
ac5229f
More styling to plant matching page
alexajah Oct 5, 2026
0809c2d
Added a suggestion for layout of the information page
alexajah Oct 5, 2026
336932e
Ran linting and prettier in frontend
alexajah Oct 5, 2026
f2de404
Clean-up in the files
alexajah Oct 6, 2026
09de265
More clean-up
alexajah Oct 6, 2026
7c68b4e
Removed test-code created for GraphQL
alexajah Oct 6, 2026
7f318df
More minor fixes to the code to get more plants
alexajah Oct 6, 2026
46a6cba
Changes to make the project run on the VM completly
alexajah Oct 6, 2026
0c0f5a0
Remove node_modules from repo and ignore it
alexajah Oct 6, 2026
87fccca
updated server and datbase from js to ts format
alexajah Oct 7, 2026
68b6cf2
More updates to the server to change format, and updates to the seedD…
alexajah Oct 7, 2026
8e97bab
Resolve follow up errors from js to ts migration
Oct 8, 2026
fea3062
Updated .gitgnore
alexajah Oct 12, 2026
16f7af5
Merge branch 'main' into 23-backend-setup
alexajah Oct 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MONGODB_URI=mongodb://localhost:27017
DB_NAME=plants
PERENUAL_API_KEY=
3 changes: 3 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.env
dist
65 changes: 65 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Backend

GraphQL-backend (Apollo Server) for I <3 Plants. Dataene ligger i MongoDB på VM-en `it2810-03.idi.ntnu.no`.

Under utvikling kjører backenden på din egen maskin og kobler seg til MongoDB på VM-en gjennom en SSH-tunnel:

```
Din maskin VM (it2810-03)
backend (localhost:4000) ──tunnel──> MongoDB (port 27017)
```

MongoDB lytter bare på `127.0.0.1` på VM-en, så den kan ikke nås direkte utenfra. All tilgang går via SSH.

## Kom i gang

### 1. Koble til NTNU-nettet

VM-en kan bare nås fra NTNU-nettet. Er du hjemme, må du koble til NTNU VPN først.

### 2. Installer avhengigheter
Inne i prosjekt i terminal kjør:

```bash
cd backend
npm install
```

### 3. Lag `.env`

```bash
cp .env.example .env
```

Du trenger ikke endre noe i den. `.env` står i `.gitignore` og skal aldri committes.

### 4. Start SSH-tunnelen

Åpne et **eget terminalvindu** på PCen din, bytt ut `<ntnu-brukernavn>` og kjør:

```bash
ssh -N -L 27017:localhost:27017 <ntnu-brukernavn>@it2810-03.idi.ntnu.no
```

Når du har skrevet inn passordet, ser det ut som kommandoen henger. Det er riktig, og betyr at tunnelen er oppe. La vinduet stå åpent mens du jobber/ kjører prosjektet. Stopp tunnelen med `Ctrl+C` når du er ferdig med å kjøre prosjektet.

Sjekk at tunnelen virker (i et annet vindu):

```bash
nc -z localhost 27017 && echo "Tunnel OK"
```

### 5. Start backenden

```bash
npm run dev
```

Du skal se:

```
Connected to MongoDB
Server Running at:http://localhost:4000/
```
Da er DB koblingen satt opp riktig

Loading