Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed a bug for new jsonwebtoken module callback
- Loading branch information
seanpmaxwell
committed
May 25, 2020
1 parent
2620f64
commit 71a01d6
Showing
77 changed files
with
571 additions
and
544 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
38 changes: 19 additions & 19 deletions
38
sample-output/withAuthOption/dist/LoadEnv.js → sample-output/WithAuth/dist/LoadEnv.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const dotenv_1 = tslib_1.__importDefault(require("dotenv")); | ||
const command_line_args_1 = tslib_1.__importDefault(require("command-line-args")); | ||
const options = command_line_args_1.default([ | ||
{ | ||
name: 'env', | ||
alias: 'e', | ||
defaultValue: 'production', | ||
type: String, | ||
}, | ||
]); | ||
const result2 = dotenv_1.default.config({ | ||
path: `./env/${options.env}.env`, | ||
}); | ||
if (result2.error) { | ||
throw result2.error; | ||
} | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const dotenv_1 = tslib_1.__importDefault(require("dotenv")); | ||
const command_line_args_1 = tslib_1.__importDefault(require("command-line-args")); | ||
const options = command_line_args_1.default([ | ||
{ | ||
name: 'env', | ||
alias: 'e', | ||
defaultValue: 'production', | ||
type: String, | ||
}, | ||
]); | ||
const result2 = dotenv_1.default.config({ | ||
path: `./env/${options.env}.env`, | ||
}); | ||
if (result2.error) { | ||
throw result2.error; | ||
} |
94 changes: 47 additions & 47 deletions
94
sample-output/withAuthOption/dist/Server.js → sample-output/WithAuth/dist/Server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const cookie_parser_1 = tslib_1.__importDefault(require("cookie-parser")); | ||
const morgan_1 = tslib_1.__importDefault(require("morgan")); | ||
const path_1 = tslib_1.__importDefault(require("path")); | ||
const helmet_1 = tslib_1.__importDefault(require("helmet")); | ||
const express_1 = tslib_1.__importDefault(require("express")); | ||
const http_status_codes_1 = require("http-status-codes"); | ||
require("express-async-errors"); | ||
const routes_1 = tslib_1.__importDefault(require("./routes")); | ||
const Logger_1 = tslib_1.__importDefault(require("@shared/Logger")); | ||
const constants_1 = require("@shared/constants"); | ||
const app = express_1.default(); | ||
app.use(express_1.default.json()); | ||
app.use(express_1.default.urlencoded({ extended: true })); | ||
app.use(cookie_parser_1.default(process.env.COOKIE_SECRET)); | ||
if (process.env.NODE_ENV === 'development') { | ||
app.use(morgan_1.default('dev')); | ||
} | ||
if (process.env.NODE_ENV === 'production') { | ||
app.use(helmet_1.default()); | ||
} | ||
app.use('/api', routes_1.default); | ||
app.use((err, req, res, next) => { | ||
Logger_1.default.error(err.message, err); | ||
return res.status(http_status_codes_1.BAD_REQUEST).json({ | ||
error: err.message, | ||
}); | ||
}); | ||
const viewsDir = path_1.default.join(__dirname, 'views'); | ||
app.set('views', viewsDir); | ||
const staticDir = path_1.default.join(__dirname, 'public'); | ||
app.use(express_1.default.static(staticDir)); | ||
app.get('/', (req, res) => { | ||
res.sendFile('login.html', { root: viewsDir }); | ||
}); | ||
app.get('/users', (req, res) => { | ||
const jwt = req.signedCookies[constants_1.cookieProps.key]; | ||
if (!jwt) { | ||
res.redirect('/'); | ||
} | ||
else { | ||
res.sendFile('users.html', { root: viewsDir }); | ||
} | ||
}); | ||
exports.default = app; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const cookie_parser_1 = tslib_1.__importDefault(require("cookie-parser")); | ||
const morgan_1 = tslib_1.__importDefault(require("morgan")); | ||
const path_1 = tslib_1.__importDefault(require("path")); | ||
const helmet_1 = tslib_1.__importDefault(require("helmet")); | ||
const express_1 = tslib_1.__importDefault(require("express")); | ||
const http_status_codes_1 = require("http-status-codes"); | ||
require("express-async-errors"); | ||
const routes_1 = tslib_1.__importDefault(require("./routes")); | ||
const Logger_1 = tslib_1.__importDefault(require("@shared/Logger")); | ||
const constants_1 = require("@shared/constants"); | ||
const app = express_1.default(); | ||
app.use(express_1.default.json()); | ||
app.use(express_1.default.urlencoded({ extended: true })); | ||
app.use(cookie_parser_1.default(process.env.COOKIE_SECRET)); | ||
if (process.env.NODE_ENV === 'development') { | ||
app.use(morgan_1.default('dev')); | ||
} | ||
if (process.env.NODE_ENV === 'production') { | ||
app.use(helmet_1.default()); | ||
} | ||
app.use('/api', routes_1.default); | ||
app.use((err, req, res, next) => { | ||
Logger_1.default.error(err.message, err); | ||
return res.status(http_status_codes_1.BAD_REQUEST).json({ | ||
error: err.message, | ||
}); | ||
}); | ||
const viewsDir = path_1.default.join(__dirname, 'views'); | ||
app.set('views', viewsDir); | ||
const staticDir = path_1.default.join(__dirname, 'public'); | ||
app.use(express_1.default.static(staticDir)); | ||
app.get('/', (req, res) => { | ||
res.sendFile('login.html', { root: viewsDir }); | ||
}); | ||
app.get('/users', (req, res) => { | ||
const jwt = req.signedCookies[constants_1.cookieProps.key]; | ||
if (!jwt) { | ||
res.redirect('/'); | ||
} | ||
else { | ||
res.sendFile('users.html', { root: viewsDir }); | ||
} | ||
}); | ||
exports.default = app; |
33 changes: 17 additions & 16 deletions
33
...thOption/dist/daos/MockDb/MockDao.mock.js → ...WithAuth/dist/daos/MockDb/MockDao.mock.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const jsonfile_1 = tslib_1.__importDefault(require("jsonfile")); | ||
class MockDaoMock { | ||
constructor() { | ||
this.dbFilePath = 'src/daos/MockDb/MockDb.json'; | ||
} | ||
openDb() { | ||
return jsonfile_1.default.readFile(this.dbFilePath); | ||
} | ||
saveDb(db) { | ||
return jsonfile_1.default.writeFile(this.dbFilePath, db); | ||
} | ||
} | ||
exports.MockDaoMock = MockDaoMock; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MockDaoMock = void 0; | ||
const tslib_1 = require("tslib"); | ||
const jsonfile_1 = tslib_1.__importDefault(require("jsonfile")); | ||
class MockDaoMock { | ||
constructor() { | ||
this.dbFilePath = 'src/daos/MockDb/MockDb.json'; | ||
} | ||
openDb() { | ||
return jsonfile_1.default.readFile(this.dbFilePath); | ||
} | ||
saveDb(db) { | ||
return jsonfile_1.default.writeFile(this.dbFilePath, db); | ||
} | ||
} | ||
exports.MockDaoMock = MockDaoMock; |
62 changes: 31 additions & 31 deletions
62
.../withAuthOption/dist/daos/User/UserDao.js → ...output/WithAuth/dist/daos/User/UserDao.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
class UserDao { | ||
getOne(email) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return []; | ||
}); | ||
} | ||
getAll() { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return []; | ||
}); | ||
} | ||
add(user) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return {}; | ||
}); | ||
} | ||
update(user) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return {}; | ||
}); | ||
} | ||
delete(id) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return {}; | ||
}); | ||
} | ||
} | ||
exports.default = UserDao; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
class UserDao { | ||
getOne(email) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return []; | ||
}); | ||
} | ||
getAll() { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return []; | ||
}); | ||
} | ||
add(user) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return {}; | ||
}); | ||
} | ||
update(user) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return {}; | ||
}); | ||
} | ||
delete(id) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return {}; | ||
}); | ||
} | ||
} | ||
exports.default = UserDao; |
Oops, something went wrong.