Skip to content
Merged
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
8 changes: 5 additions & 3 deletions backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { allResolvers, allTypeDefs } from './graphql';

const PORT = Number(process.env.PORT ?? 3001);

const HOST = '127.0.0.1';

async function main() {
const app = express();
// Each feature adds its own types and resolvers. See graphql.ts.
Expand Down Expand Up @@ -39,9 +41,9 @@ async function main() {
// SameSite=Lax cookie is not sent with cross-site POSTs. Together they protect the login cookie.
app.use('/graphql', express.json(), expressMiddleware(apollo, { context: createContext }));

app.listen(PORT, () => {
console.log(`Backend listening on http://localhost:${PORT}`);
console.log(`GraphQL: http://localhost:${PORT}/graphql`);
app.listen(PORT, HOST, () => {
console.log(`Backend listening on http://${HOST}:${PORT}`);
console.log(`GraphQL: http://${HOST}:${PORT}/graphql`);
});
}

Expand Down
1 change: 1 addition & 0 deletions docs/vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ This is done once per VM. Steps 1 to 3 are done once for each person who deploys
## Apache

Apache serves the built frontend and forwards `/project2/graphql` to the backend on port 3001.
The backend listens only on `127.0.0.1`, so port 3001 cannot be reached from outside the VM.
The configuration is in `/etc/apache2/conf-available/project2.conf`:

```apache
Expand Down