Skip to content

Commit e5d2ae1

Browse files
committed
Rename app to server.
1 parent 3b66b65 commit e5d2ae1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

graphql-server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
const graphqlHTTP = require('express-graphql')
33
const { buildSchema } = require('graphql')
44
const express = require('express')
5-
const app = express()
5+
const server = express()
66

77
// Get the Mongoose models used for querying the database
88
const { User, Group } = require('./models.js')
99

1010
// Start up a GraphQL endpoint listening at /graphql
11-
app.use(
11+
server.use(
1212
'/graphql',
1313
graphqlHTTP({
1414
// We construct our GraphQL schema which has three types:
@@ -59,4 +59,4 @@ app.use(
5959
)
6060

6161
// Start the application, listening on port 3000
62-
app.listen(3000)
62+
server.listen(3000)

rest-server.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22
const express = require('express')
3-
const app = express()
3+
const server = express()
44

55
// Get the Mongoose models used for querying the database
66
const { User } = require('./models.js')
@@ -32,7 +32,7 @@ const filterFields = async function(req, user) {
3232

3333
// Listen for all GET requests to /users/:id URL (where the
3434
// ID is the ID of the user account)
35-
app.get('/users/:id', (req, res) => {
35+
server.get('/users/:id', (req, res) => {
3636
// Try to find the user by their id (_id field), using the ID
3737
// parameter from the URL.
3838
User.findById(req.params.id, async (err, user) => {
@@ -54,7 +54,7 @@ app.get('/users/:id', (req, res) => {
5454
})
5555

5656
// Listen for all GET requests to /users
57-
app.get('/users', (req, res) => {
57+
server.get('/users', (req, res) => {
5858
// Find all of the users in the database collection (we pass in
5959
// an empty collection as we aren't filtering the results)
6060
User.find({}, async (err, users) => {
@@ -73,4 +73,4 @@ app.get('/users', (req, res) => {
7373
})
7474

7575
// Start the application, listening on port 3000
76-
app.listen(3000)
76+
server.listen(3000)

0 commit comments

Comments
 (0)