1
0
mirror of https://github.com/microsoft/TypeScript-Node-Starter.git synced 2025-11-08 23:49:11 +00:00

Merge branch 'updateDependencies'

This commit is contained in:
Bowden Kelly
2019-05-10 12:38:02 -07:00
7 changed files with 4019 additions and 3964 deletions

View File

@@ -9,7 +9,7 @@ module.exports = {
'js'
],
transform: {
'^.+\\.(ts|tsx)$': './node_modules/ts-jest/preprocessor.js'
'^.+\\.(ts|tsx)$': 'ts-jest'
},
testMatch: [
'**/test/**/*.test.(ts|js)'

7941
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -42,13 +42,13 @@
"fbgraph": "^1.4.1",
"lodash": "^4.17.5",
"lusca": "^1.5.2",
"mongoose": "^4.13.11",
"mongoose": "^5.4.2",
"nodemailer": "^4.4.1",
"passport": "^0.4.0",
"passport-facebook": "^2.1.1",
"passport-local": "^1.0.0",
"pug": "^2.0.0-rc.4",
"request": "^2.83.0",
"pug": "^2.0.3",
"request": "^2.88.0",
"request-promise": "^4.2.2",
"winston": "^2.4.0"
},
@@ -64,7 +64,7 @@
"@types/express": "^4.11.1",
"@types/express-session": "^1.15.8",
"@types/jest": "^22.1.3",
"@types/jquery": "^3.2.17",
"@types/jquery": "^3.3.29",
"@types/lodash": "^4.14.91",
"@types/lusca": "^1.5.0",
"@types/mongodb": "^3.0.5",
@@ -81,14 +81,14 @@
"@types/winston": "^2.3.7",
"chai": "^4.1.2",
"concurrently": "^3.5.1",
"jest": "^22.0.4",
"node-sass": "^4.7.2",
"nodemon": "^1.13.0",
"jest": "^24.0.0",
"node-sass": "^4.12.0",
"nodemon": "^1.18.10",
"shelljs": "^0.8.1",
"supertest": "^3.0.0",
"ts-jest": "^22.0.4",
"ts-jest": "^24.0.0",
"ts-node": "^5.0.0",
"tslint": "^5.9.1",
"typescript": "^2.7.2"
"typescript": "^3.4.5"
}
}

View File

@@ -35,7 +35,7 @@ const app = express();
// Connect to MongoDB
const mongoUrl = MONGODB_URI;
(<any>mongoose).Promise = bluebird;
mongoose.connect(mongoUrl, {useMongoClient: true}).then(
mongoose.connect(mongoUrl).then(
() => { /** ready to use. The `mongoose.connect()` promise resolves to undefined. */ },
).catch(err => {
console.log("MongoDB connection error. Please make sure MongoDB is running. " + err);

View File

@@ -5,7 +5,7 @@ import passportFacebook from "passport-facebook";
import _ from "lodash";
// import { User, UserType } from '../models/User';
import { default as User } from "../models/User";
import { User } from "../models/User";
import { Request, Response, NextFunction } from "express";
const LocalStrategy = passportLocal.Strategy;

View File

@@ -2,7 +2,7 @@ import async from "async";
import crypto from "crypto";
import nodemailer from "nodemailer";
import passport from "passport";
import { default as User, UserModel, AuthToken } from "../models/User";
import { User, UserDocument, AuthToken } from "../models/User";
import { Request, Response, NextFunction } from "express";
import { IVerifyOptions } from "passport-local";
import { WriteError } from "mongodb";
@@ -39,7 +39,7 @@ export let postLogin = (req: Request, res: Response, next: NextFunction) => {
return res.redirect("/login");
}
passport.authenticate("local", (err: Error, user: UserModel, info: IVerifyOptions) => {
passport.authenticate("local", (err: Error, user: UserDocument, info: IVerifyOptions) => {
if (err) { return next(err); }
if (!user) {
req.flash("errors", info.message);
@@ -140,7 +140,7 @@ export let postUpdateProfile = (req: Request, res: Response, next: NextFunction)
return res.redirect("/account");
}
User.findById(req.user.id, (err, user: UserModel) => {
User.findById(req.user.id, (err, user: UserDocument) => {
if (err) { return next(err); }
user.email = req.body.email || "";
user.profile.name = req.body.name || "";
@@ -176,7 +176,7 @@ export let postUpdatePassword = (req: Request, res: Response, next: NextFunction
return res.redirect("/account");
}
User.findById(req.user.id, (err, user: UserModel) => {
User.findById(req.user.id, (err, user: UserDocument) => {
if (err) { return next(err); }
user.password = req.body.password;
user.save((err: WriteError) => {
@@ -278,7 +278,7 @@ export let postReset = (req: Request, res: Response, next: NextFunction) => {
});
});
},
function sendResetPasswordEmail(user: UserModel, done: Function) {
function sendResetPasswordEmail(user: UserDocument, done: Function) {
const transporter = nodemailer.createTransport({
service: "SendGrid",
auth: {
@@ -352,7 +352,7 @@ export let postForgot = (req: Request, res: Response, next: NextFunction) => {
});
});
},
function sendForgotPasswordEmail(token: AuthToken, user: UserModel, done: Function) {
function sendForgotPasswordEmail(token: AuthToken, user: UserDocument, done: Function) {
const transporter = nodemailer.createTransport({
service: "SendGrid",
auth: {

View File

@@ -2,7 +2,7 @@ import bcrypt from "bcrypt-nodejs";
import crypto from "crypto";
import mongoose from "mongoose";
export type UserModel = mongoose.Document & {
export type UserDocument = mongoose.Document & {
email: string,
password: string,
passwordResetToken: string,
@@ -88,6 +88,4 @@ userSchema.methods.gravatar = function (size: number) {
return `https://gravatar.com/avatar/${md5}?s=${size}&d=retro`;
};
// export const User: UserType = mongoose.model<UserType>('User', userSchema);
const User = mongoose.model("User", userSchema);
export default User;
export const User = mongoose.model<UserDocument>("User", userSchema);