Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ From the repo root:
npm run dev
```

This starts both the backend (http://localhost:4000) and the frontend. Open http://localhost:5173/project2/ in your browser. The frontend forwards `/graphql` requests to the backend, so both must be running.
This starts both the backend (http://localhost:3001) and the frontend. Open http://localhost:5173/project2/ in your browser. The frontend forwards `/graphql` requests to the backend, so both must be running.

See [backend/README.md](backend/README.md) for more details about the backend setup (in Norwegian).

Expand All @@ -118,7 +118,7 @@ The project has three `package.json` files: one in the repo root, one in `backen
| Command | What it does | When to use it |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| `npm run install:all` | Runs `npm install` in the root, `backend` and `frontend`. | After cloning, and after pulling changes to any `package.json`. |
| `npm run dev` | Starts the backend (`tsx watch`, port 4000) and the frontend (Vite, port 5173) in the same terminal with [concurrently](https://www.npmjs.com/package/concurrently). Output is prefixed with `[backend]` (blue) and `[frontend]` (green). Both restart or reload automatically when you save a file. Stop both with `Ctrl+C`. | Day-to-day development. The SSH tunnel must be open first. |
| `npm run dev` | Starts the backend (`tsx watch`, port 3001) and the frontend (Vite, port 5173) in the same terminal with [concurrently](https://www.npmjs.com/package/concurrently). Output is prefixed with `[backend]` (blue) and `[frontend]` (green). Both restart or reload automatically when you save a file. Stop both with `Ctrl+C`. | Day-to-day development. The SSH tunnel must be open first. |
| `npm run build` | Compiles the backend with `tsc` to `backend/dist`, then type checks and builds the frontend with Vite to `frontend/dist`. Stops at the first error. | To check that everything compiles, and before deploying. |
| `npm run lint` | Runs ESLint in `backend`, then in `frontend`. | Before you push or open a pull request. |
| `npm test` | Runs the frontend tests once with Vitest and exits. | Before you push or open a pull request. |
Expand Down
4 changes: 2 additions & 2 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Under utvikling kjører backenden på din egen maskin og kobler seg til MongoDB

```
Din maskin VM (it2810-03)
backend (localhost:4000) ──tunnel──> MongoDB (port 27017)
backend (localhost:3001) ──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.
Expand Down Expand Up @@ -60,7 +60,7 @@ Du skal se:

```
Connected to MongoDB
Server Running at:http://localhost:4000/
Server Running at:http://localhost:3001/
```

Da er DB koblingen satt opp riktig
7 changes: 0 additions & 7 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const resolvers = {
const server = new ApolloServer({ typeDefs, resolvers });

const { url } = await startStandaloneServer(server, {
listen: { port: Number(process.env.PORT) || 4000 },
listen: { port: Number(process.env.PORT) || 3001 },
});

console.log(`Server Running at:${url}`);
Loading
Loading