mirror of
https://github.com/microsoft/TypeScript-Node-Starter.git
synced 2025-11-08 16:17:37 +00:00
Merge pull request #85 from peterblazejewicz/feat/81
Update sources, syntax and dependency to work with TypeScript 2.7. Closes #81
This commit is contained in:
3945
package-lock.json
generated
3945
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
46
package.json
46
package.json
@@ -41,7 +41,7 @@
|
||||
"fbgraph": "^1.4.1",
|
||||
"lodash": "^4.17.4",
|
||||
"lusca": "^1.5.2",
|
||||
"mongoose": "^4.13.7",
|
||||
"mongoose": "^4.13.11",
|
||||
"morgan": "^1.9.0",
|
||||
"nodemailer": "^4.4.1",
|
||||
"passport": "^0.4.0",
|
||||
@@ -52,40 +52,40 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/async": "^2.0.45",
|
||||
"@types/bcrypt-nodejs": "0.0.30",
|
||||
"@types/bluebird": "^3.5.18",
|
||||
"@types/bcrypt-nodejs": "^0.0.30",
|
||||
"@types/bluebird": "^3.5.20",
|
||||
"@types/body-parser": "^1.16.8",
|
||||
"@types/compression": "0.0.33",
|
||||
"@types/connect-mongo": "0.0.34",
|
||||
"@types/compression": "^0.0.35",
|
||||
"@types/connect-mongo": "^0.0.35",
|
||||
"@types/dotenv": "^4.0.2",
|
||||
"@types/errorhandler": "0.0.32",
|
||||
"@types/express": "^4.0.35",
|
||||
"@types/express-session": "^1.15.6",
|
||||
"@types/jest": "^21.1.8",
|
||||
"@types/errorhandler": "^0.0.32",
|
||||
"@types/express": "^4.11.1",
|
||||
"@types/express-session": "^1.15.8",
|
||||
"@types/jest": "^22.1.3",
|
||||
"@types/jquery": "^3.2.17",
|
||||
"@types/lodash": "^4.14.91",
|
||||
"@types/lusca": "^1.5.0",
|
||||
"@types/mongodb": "^2.2.17",
|
||||
"@types/mongoose": "^4.7.29",
|
||||
"@types/morgan": "^1.7.32",
|
||||
"@types/node": "^7.0.50",
|
||||
"@types/nodemailer": "^1.3.32",
|
||||
"@types/passport": "^0.3.3",
|
||||
"@types/passport-facebook": "^2.1.3",
|
||||
"@types/mongodb": "^3.0.5",
|
||||
"@types/mongoose": "^4.7.34",
|
||||
"@types/morgan": "^1.7.35",
|
||||
"@types/node": "^9.4.6",
|
||||
"@types/nodemailer": "^4.3.4",
|
||||
"@types/passport": "^0.4.3",
|
||||
"@types/passport-facebook": "^2.1.7",
|
||||
"@types/passport-local": "^1.0.32",
|
||||
"@types/request": "^2.0.9",
|
||||
"@types/request": "^2.47.0",
|
||||
"@types/shelljs": "^0.7.8",
|
||||
"@types/supertest": "^2.0.4",
|
||||
"@types/shelljs": "^0.7.7",
|
||||
"chai": "^4.1.2",
|
||||
"concurrently": "^3.5.1",
|
||||
"jest": "^21.2.1",
|
||||
"jest": "^22.0.4",
|
||||
"node-sass": "^4.7.2",
|
||||
"nodemon": "^1.13.0",
|
||||
"shelljs": "^0.7.7",
|
||||
"supertest": "^3.0.0",
|
||||
"ts-jest": "^21.2.4",
|
||||
"ts-node": "^4.0.2",
|
||||
"tslint": "^5.8.0",
|
||||
"typescript": "^2.6.2"
|
||||
"ts-jest": "^22.0.4",
|
||||
"ts-node": "^5.0.0",
|
||||
"tslint": "^5.9.1",
|
||||
"typescript": "^2.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
35
src/app.ts
35
src/app.ts
@@ -1,17 +1,17 @@
|
||||
import * as express from "express";
|
||||
import * as compression from "compression"; // compresses requests
|
||||
import * as session from "express-session";
|
||||
import * as bodyParser from "body-parser";
|
||||
import * as logger from "morgan";
|
||||
import * as lusca from "lusca";
|
||||
import * as dotenv from "dotenv";
|
||||
import * as mongo from "connect-mongo";
|
||||
import * as flash from "express-flash";
|
||||
import * as path from "path";
|
||||
import * as mongoose from "mongoose";
|
||||
import * as passport from "passport";
|
||||
import * as expressValidator from "express-validator";
|
||||
import * as bluebird from "bluebird";
|
||||
import express from "express";
|
||||
import compression from "compression"; // compresses requests
|
||||
import session from "express-session";
|
||||
import bodyParser from "body-parser";
|
||||
import logger from "morgan";
|
||||
import lusca from "lusca";
|
||||
import dotenv from "dotenv";
|
||||
import mongo from "connect-mongo";
|
||||
import flash from "express-flash";
|
||||
import path from "path";
|
||||
import mongoose from "mongoose";
|
||||
import passport from "passport";
|
||||
import expressValidator from "express-validator";
|
||||
import bluebird from "bluebird";
|
||||
|
||||
const MongoStore = mongo(session);
|
||||
|
||||
@@ -82,7 +82,10 @@ app.use((req, res, next) => {
|
||||
}
|
||||
next();
|
||||
});
|
||||
app.use(express.static(path.join(__dirname, "public"), { maxAge: 31557600000 }));
|
||||
|
||||
app.use(
|
||||
express.static(path.join(__dirname, "public"), { maxAge: 31557600000 })
|
||||
);
|
||||
|
||||
/**
|
||||
* Primary app routes.
|
||||
@@ -119,4 +122,4 @@ app.get("/auth/facebook/callback", passport.authenticate("facebook", { failureRe
|
||||
res.redirect(req.session.returnTo || "/");
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
export default app;
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as passport from "passport";
|
||||
import * as request from "request";
|
||||
import * as passportLocal from "passport-local";
|
||||
import * as passportFacebook from "passport-facebook";
|
||||
import * as _ from "lodash";
|
||||
import passport from "passport";
|
||||
import request from "request";
|
||||
import passportLocal from "passport-local";
|
||||
import passportFacebook from "passport-facebook";
|
||||
import _ from "lodash";
|
||||
|
||||
// import { User, UserType } from '../models/User';
|
||||
import { default as User } from "../models/User";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
import * as async from "async";
|
||||
import * as request from "request";
|
||||
import * as graph from "fbgraph";
|
||||
import async from "async";
|
||||
import request from "request";
|
||||
import graph from "fbgraph";
|
||||
import { Response, Request, NextFunction } from "express";
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as nodemailer from "nodemailer";
|
||||
import nodemailer from "nodemailer";
|
||||
import { Request, Response } from "express";
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as async from "async";
|
||||
import * as crypto from "crypto";
|
||||
import * as nodemailer from "nodemailer";
|
||||
import * as passport from "passport";
|
||||
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 { Request, Response, NextFunction } from "express";
|
||||
import { IVerifyOptions } from "passport-local";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as bcrypt from "bcrypt-nodejs";
|
||||
import * as crypto from "crypto";
|
||||
import * as mongoose from "mongoose";
|
||||
import bcrypt from "bcrypt-nodejs";
|
||||
import crypto from "crypto";
|
||||
import mongoose from "mongoose";
|
||||
|
||||
export type UserModel = mongoose.Document & {
|
||||
email: string,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as errorHandler from "errorhandler";
|
||||
import errorHandler from "errorhandler";
|
||||
|
||||
const app = require("./app");
|
||||
import app from "./app";
|
||||
|
||||
/**
|
||||
* Error Handler. Provides full stack - remove for production
|
||||
@@ -11,8 +11,12 @@ app.use(errorHandler());
|
||||
* Start Express server.
|
||||
*/
|
||||
const server = app.listen(app.get("port"), () => {
|
||||
console.log((" App is running at http://localhost:%d in %s mode"), app.get("port"), app.get("env"));
|
||||
console.log(
|
||||
" App is running at http://localhost:%d in %s mode",
|
||||
app.get("port"),
|
||||
app.get("env")
|
||||
);
|
||||
console.log(" Press CTRL-C to stop\n");
|
||||
});
|
||||
|
||||
export = server;
|
||||
export default server;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as request from "supertest";
|
||||
import * as app from "../src/app";
|
||||
import request from "supertest";
|
||||
import app from "../src/app";
|
||||
|
||||
describe("GET /api", () => {
|
||||
it("should return 200 OK", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as request from "supertest";
|
||||
import * as app from "../src/app";
|
||||
import request from "supertest";
|
||||
import app from "../src/app";
|
||||
|
||||
describe("GET /random-url", () => {
|
||||
it("should return 404", (done) => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as request from "supertest";
|
||||
import * as app from "../src/app";
|
||||
import request from "supertest";
|
||||
import app from "../src/app";
|
||||
|
||||
var chai = require('chai');
|
||||
var expect = chai.expect;
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
describe("GET /contact", () => {
|
||||
it("should return 200 OK", (done) => {
|
||||
@@ -22,6 +22,6 @@ describe("POST /contact", () => {
|
||||
done();
|
||||
})
|
||||
.expect(302);
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as request from "supertest";
|
||||
import * as app from "../src/app";
|
||||
import request from "supertest";
|
||||
import app from "../src/app";
|
||||
|
||||
describe("GET /", () => {
|
||||
it("should return 200 OK", (done) => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as request from "supertest";
|
||||
import * as app from "../src/app";
|
||||
import request from "supertest";
|
||||
import app from "../src/app";
|
||||
|
||||
var chai = require('chai');
|
||||
var expect = chai.expect;
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
describe("GET /login", () => {
|
||||
it("should return 200 OK", () => {
|
||||
@@ -29,6 +29,6 @@ describe("POST /login", () => {
|
||||
expect(res.error).not.to.be.undefined;
|
||||
done();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "node",
|
||||
|
||||
Reference in New Issue
Block a user