Skip to content

Commit

Permalink
fix bug in Add Apartment not showing default date. Fixed bug in Add A…
Browse files Browse the repository at this point in the history
…partment when selecting tags. Added loading message when submmiting new apartment. Fixed upload Images components showing error when adding new image, Modified error handling by rote POST /apartments. #164 #167 #168 #169 #170 #171 #172
  • Loading branch information
alonttal committed Jan 18, 2018
2 parents 26d162f + 0d4d987 commit 314de53
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 159 deletions.
5 changes: 3 additions & 2 deletions server/db/mongoose.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const mongoose = require('mongoose');
const {logInfo, logError} = require('../services/logger/logger');

mongoose.Promise = global.Promise;
mongoose.connect(process.env.MONGODB_URI, { useMongoClient: true })
.then(() =>
console.log('Mongoose connection success.')
logInfo('Mongoose connection success.')
).catch((err) =>
console.error(`Mongoose connection error!\n${err}`)
logError(`Mongoose connection error!\n${err}`)
);

module.exports = {
Expand Down
12 changes: 11 additions & 1 deletion server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const _ = require('lodash');
const {
BAD_REQUEST, NOT_FOUND, UNAUTHORIZED, OK
} = require('http-status');
const httpRequestLogger = require('morgan');

require('./server-config');
require('./db/mongoose');
Expand All @@ -16,10 +17,19 @@ const { XAUTH, XEXPIRATION } = require('./constants');
const { authenticate } = require('./middleware/authenticate');
const { getSupportedHobbies } = require('./models/hobbie');
const { getSupportedTags } = require('./models/tag');
<<<<<<< HEAD
const errors = require('./errors');
=======
const {logger, logInfo} = require('./services/logger/logger');

>>>>>>> refs/remotes/origin/master

const app = express();

app.use(httpRequestLogger("common", { stream: logger.stream }, {
skip: function (req, res) { return res.statusCode < BAD_REQUEST; }
}));

app.use(bodyParser.json({ limit: '5mb' }));
useCors(app);
useVue(app);
Expand Down Expand Up @@ -296,7 +306,7 @@ app.patch('/users/self', authenticate, async (req, res) => {


app.listen(process.env.PORT, () => {
console.log(`Server is up on port ${process.env.PORT}.`);
logInfo(`Server is up on port ${process.env.PORT}.`);
});

module.exports = {
Expand Down
Loading

0 comments on commit 314de53

Please sign in to comment.