Skip to content

Commit

Permalink
Merge pull request #27 from apavlidi/apavlidi-fix-errors
Browse files Browse the repository at this point in the history
Apavlidi fix errors
  • Loading branch information
kvisnia authored Aug 19, 2018
2 parents 838901b + 1713df9 commit 3500b03
Show file tree
Hide file tree
Showing 10 changed files with 493 additions and 548 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
configs/database.js
test/announcements.js
routes/translate.js
configs/ldap.js
coverage/
1 change: 0 additions & 1 deletion .eslintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
"extends": "standard"
};
21 changes: 11 additions & 10 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const apiFunctions = require('./routes/apiFunctions')

app.use(logger('dev'))
app.use(bodyParser.json())
app.use(compression()) // Κανει compress ολα τα responses.Διαβασα οτι παντα πρεπει να γινεται compress στο response
app.use(compression()) // Κανει compress ολα τα responses.Διαβασα οτι παντα πρεπει να γινεται compress στο response
app.use(bodyParser.urlencoded({extended: false}))
app.use(express.static(path.join(__dirname, 'public')))
app.use(fileUpload())
Expand All @@ -46,8 +46,8 @@ app.all('/*', apiFunctions.sanitizeInput, function (req, res, next) {

app.use('/', index)
app.use('/announcements', announcements)
app.use('/announcements/categories', categories)
app.use('/announcements/files', announcementFiles)
app.use('/categories', categories)
app.use('/files', announcementFiles)
app.use('/notifications', notifications)
app.use('/reg', reg)
app.use('/user', user)
Expand Down Expand Up @@ -77,13 +77,12 @@ mongoose.connect(config.MONGO[process.env.NODE_ENV], {

// catch 404 and forward to error handler
app.use(function (req, res, next) {
res.status(404).json({
error: {
message: 'Ο σύνδεσμος δεν βρέθηκε',
type: 'WrongEndPointError',
code: '2000'
}
})
let err = {
message: 'Ο σύνδεσμος δεν βρέθηκε',
type: 'WrongEndPointError',
code: '9000'
}
next(err)
})

// error handler
Expand All @@ -99,6 +98,8 @@ app.use(function (err, req, res, next) {
code: err.httpCode
}
})
} else if (err.code === '9000') {
res.status(404).json(err)
} else {
res.status(500).json({
error: {
Expand Down
2 changes: 1 addition & 1 deletion configs/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const audience = {
development: '59a99d5989ef64657780879c'
}

const cert = fs.readFileSync('./public.pem') // get public key
const cert = fs.readFileSync('./public.pem') // get public key
const config = require('./config')

const ldapClient = ldap.createClient({
Expand Down
Loading

0 comments on commit 3500b03

Please sign in to comment.