Skip to content

Commit 4e92816

Browse files
final commit
1 parent ec7f54d commit 4e92816

File tree

18 files changed

+404
-658
lines changed

18 files changed

+404
-658
lines changed

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Fit-Journal with NodeJS
22

3-
View project at www.fit-journal.herokuapp.com (currently still in development)
3+
View project at www.fit-journal.herokuapp.com
44

55
Track your workout history whether it be resistance or cardiovascular training, all in one place!
66
This project is built on Node and Express using CRUD standard practices.
@@ -19,13 +19,6 @@ These instructions will get you a copy of the project up and running on your loc
1919
Tests completed with faker.js and Chai
2020
To supply data for testing and assertions
2121

22-
### Break down into end to end tests
23-
24-
Explain what these tests test and why
25-
26-
```
27-
Give an example
28-
```
2922

3023
### And coding style tests
3124

app/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ module.exports = {
99
NOT_FOUND: 404,
1010
INTERNAL_SERVER_ERROR: 500,
1111
},
12-
MONGO_URL: process.env.MONGO_URL || 'mongodb://localhost:27017/fit-journal',
13-
// MONGO_URL: process.env.MONGO_URL || 'mongodb://ds237932.mlab.com:37932/fit-journal',
12+
13+
MONGO_URL: process.env.MONGO_URL || 'mongodb://ds237932.mlab.com:37932/fit-journal',
1414
TEST_MONGO_URL: process.env.TEST_MONGO_URL || 'mongodb://localhost:27017/test-fit-journal',
1515
JWT_SECRET: process.env.JWT_SECRET || 'default',
1616
JWT_EXPIRY: process.env.JWT_EXPIRY || '7d',

app/exercise/exercise.model.js

Lines changed: 0 additions & 51 deletions
This file was deleted.

app/exercise/exercise.router.js

Lines changed: 0 additions & 80 deletions
This file was deleted.

app/server.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ passport.use(localStrategy);
3434
passport.use(jwtStrategy);
3535

3636
//MIDLEWARE
37-
app.use(morgan('combined')); //allows morgan to intercept and alog all http requests to console
38-
app.use(express.json()); // Required so AJAX request JSON data payload can be parsed and saved into request.body
37+
app.use(morgan('combined'));
38+
app.use(express.json());
3939
app.use(express.static('./public'));
4040
app.use(express.urlencoded({ extended: true }));
4141

4242
//ROUTER SETUP
4343
app.use('/api/auth', authRouter);
44-
app.use('/api/user', userRouter); //Redirects all calls to /api/user to userRouter
44+
app.use('/api/user', userRouter);
4545
app.use('/api/home', workoutRouter);
4646
app.use('/api/exercises', exerciseRouter);
4747
app.use(express.static('./public', {
4848
extensions: ['html', 'htm']
49-
// Other options here
49+
5050
}));
5151

5252

@@ -82,7 +82,6 @@ function startServer(testEnv) {
8282
resolve();
8383
}).on('error', err => {
8484
mongoose.disconnect();
85-
console.error(err);
8685
reject(err);
8786
});
8887
}
@@ -91,21 +90,17 @@ function startServer(testEnv) {
9190
}
9291

9392
function stopServer() {
94-
//Step 1: disconnect from MongoDB database using Mongoose
9593
return mongoose
9694
.disconnect()
9795
.then(() => new Promise((resolve, reject) => {
98-
//Step 2: Shut down the ExpressJS sever
9996
server.close(err => {
10097
if (err) {
101-
//Step 3A: if an error occurred while shutting down, print out the error to the console and resolve promise
10298
console.error(err);
10399
return reject(err);
104100
} else {
105-
//Step 3B: If server shutdown correctly, log success message.
106-
console.log('Express sever stopped');
101+
107102
resolve();
108103
}
109104
});
110105
}));
111-
}
106+
}

app/sets/sets.router.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ setsRouter.post('/', (req, res) => {
2626
}
2727
const validation = Joi.validate(newSet, SetJoiSchema);
2828
if (validation.error) {
29-
console.log("Set Validation Error")
3029
return res.status(HTTP_STATUS_CODES.BAD_REQUEST).json({
3130
error: validation.error
3231
});

app/user/user.model.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
//Connects to mongoDB
21
const mongoose = require('mongoose');
3-
//Validates data
42
const Joi = require('joi');
5-
//Encrypts passwords
63
const bcrypt = require('bcryptjs');
74

8-
// Each Mongoose schema maps to a MongoDB collection and defines the shape of the documents within that collection.
95
const userSchema = new mongoose.Schema({
106
name: {
117
type: String,

app/user/user.router.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ userRouter.post('/', (request, response) => {
6363

6464
// RETRIEVE USERS
6565
userRouter.get('/', (request, response) => {
66-
console.log("Retrieving All Users");
6766
User.find()
6867
.then(users => {
6968

@@ -82,7 +81,6 @@ userRouter.get('/:userid', (request, response) => {
8281
User.findById(request.params.userid)
8382
.then(user => {
8483

85-
console.log(request.params.userid)
8684
return response.status(HTTP_STATUS_CODES.OK).json(user.serialize());
8785

8886
})

0 commit comments

Comments
 (0)