Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code refactor for standardJS, eslint rules setup Fixes #242 #244

Closed
Closed
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
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
env: {
commonjs: true,
es6: true,
node: true
},
extends: [
'standard'
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parserOptions: {
ecmaVersion: 2018
},
rules: {
}
}
43 changes: 21 additions & 22 deletions auth/passportStrategies.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
/**
* Created by abhishek on 20/05/17.
*/
'use strict';
'use strict'

const passport = require('passport');
const OAuth2Strategy = require('passport-oauth2').Strategy;
const BearerStrategy = require('passport-http-bearer').Strategy;

const secrets = require('../secrets.json');
const auth = require('../utils/auth');
const passport = require('passport')
const OAuth2Strategy = require('passport-oauth2').Strategy
const BearerStrategy = require('passport-http-bearer').Strategy

const secrets = require('../secrets.json')
const auth = require('../utils/auth')

passport.use(new OAuth2Strategy({
authorizationURL: 'https://account.codingblocks.com/oauth/authorize',
tokenURL: 'https://account.codingblocks.com/oauth/token',
clientID: secrets.clientId,
clientSecret: secrets.clientSecret,
callbackURL: secrets.callbackURL
}, auth.oauth2Success
));
authorizationURL: 'https://account.codingblocks.com/oauth/authorize',
tokenURL: 'https://account.codingblocks.com/oauth/token',
clientID: secrets.clientId,
clientSecret: secrets.clientSecret,
callbackURL: secrets.callbackURL
}, auth.oauth2Success
))

passport.use(new BearerStrategy(auth.checkToken));
passport.use(new BearerStrategy(auth.checkToken))

passport.serializeUser(function(user, done) {
done(null, user);
});
passport.serializeUser(function (user, done) {
done(null, user)
})

passport.deserializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function (user, done) {
done(null, user)
})

module.exports = passport ;
module.exports = passport
18 changes: 9 additions & 9 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ if (process.env.NODE_ENV === 'production') {

module.exports = {
secrets,
"CLAIM_STATUS": {
"CLAIMED": "claimed",
"ACCEPTED": "accepted",
"REJECTED": "rejected",
"DISPUTED": "disputed",
"REVOKED": "revoked"
CLAIM_STATUS: {
CLAIMED: 'claimed',
ACCEPTED: 'accepted',
REJECTED: 'rejected',
DISPUTED: 'disputed',
REVOKED: 'revoked'
},
"PAGINATION_SIZE": 10,
"TEST_MODE": false
}
PAGINATION_SIZE: 10,
TEST_MODE: false
}
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const app = require('./server').app;
const db = require('./utils/db').Database;
const app = require('./server').app
const db = require('./utils/db').Database

db.sync({force: false}).then(() => {
console.log('Database configured');
db.sync({ force: false }).then(() => {
console.log('Database configured')

process.env.PORT = process.env.PORT || 3232;
process.env.PORT = process.env.PORT || 3232
app.listen(process.env.PORT, function () {
console.log("Server started on http://localhost:" + process.env.PORT);
});
});
console.log('Server started on http://localhost:' + process.env.PORT)
})
})
Loading