serverpreconfigured 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,18 @@
1
+ /// <reference types="node" />
2
+ import express from "express";
3
+ import { Express } from "express";
4
+ import { Server } from "http";
1
5
  export default class ExpressServer {
2
- app: any;
6
+ app: Express;
3
7
  authBaseUrl: string;
4
8
  usePort: number;
9
+ server?: Server;
5
10
  wsAuthBaseUrl: string;
6
11
  constructor();
7
12
  listen(port?: any): void;
8
13
  initModules(): void;
9
14
  initAuthSystem(baseUrl?: string): void;
10
15
  initWSAuthSystem(wsBaseUrl?: string): void;
11
- getApp(): any;
16
+ getApp(): express.Express;
17
+ getServer(): Server | undefined;
12
18
  }
@@ -21,7 +21,7 @@ class ExpressServer {
21
21
  listen(port = null) {
22
22
  if (port != null)
23
23
  this.usePort = parseInt(port);
24
- this.app.listen(this.usePort);
24
+ this.server = this.app.listen(this.usePort);
25
25
  }
26
26
  initModules() {
27
27
  (0, sessions_1.initSessions)(this.app);
@@ -39,5 +39,8 @@ class ExpressServer {
39
39
  getApp() {
40
40
  return this.app;
41
41
  }
42
+ getServer() {
43
+ return this.server;
44
+ }
42
45
  }
43
46
  exports.default = ExpressServer;
@@ -1,3 +1,4 @@
1
+ import { User } from "./../database/models/User";
1
2
  import { UserCreateInterface } from "./types";
2
3
  export declare function getUserSessionData(req: any): string;
3
4
  export declare function getUserById(id: Number): Promise<any>;
@@ -6,5 +7,5 @@ export declare function getUserIdByUserEmail(email: string): Promise<number>;
6
7
  export declare function deleteUserById(id: Number): Promise<any>;
7
8
  export declare function isUserExist(email: string): Promise<boolean>;
8
9
  export declare function createUser(data: UserCreateInterface): Promise<any>;
9
- export declare function changeUserPassword(email: string, password: string): Promise<Bluebird<T>>;
10
+ export declare function changeUserPassword(email: string, password: string): Promise<User>;
10
11
  export declare function checkUserPassword(email: string, password_string: string): Promise<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serverpreconfigured",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "\"Pre-configured server with authentication system and database integration\"",
5
5
  "main": "dist/server.js",
6
6
  "keywords": [
@@ -1,14 +1,17 @@
1
1
  import express from "express";
2
+ import { Express } from "express";
2
3
  import { initSessions } from "./modules/sessions";
3
4
  import { initPostReader } from "./modules/postreader";
4
5
  import { initCors } from "./modules/initcors";
5
6
  import ENV from "./settings/env";
6
7
  import authRouter from "./routes/users";
7
8
  import { router as wsAuthRoter } from "./routes/wsauth";
9
+ import { Server } from "http";
8
10
  export default class ExpressServer{
9
- app:any;
11
+ app:Express;
10
12
  authBaseUrl:string;
11
13
  usePort:number;
14
+ server?:Server;
12
15
  wsAuthBaseUrl:string;
13
16
  constructor(){
14
17
  this.authBaseUrl="";
@@ -20,7 +23,7 @@ export default class ExpressServer{
20
23
  listen(port:any=null){
21
24
  if(port!=null)
22
25
  this.usePort=parseInt(port);
23
- this.app.listen(this.usePort);
26
+ this.server=this.app.listen(this.usePort);
24
27
  }
25
28
 
26
29
  initModules(){
@@ -40,4 +43,7 @@ export default class ExpressServer{
40
43
  getApp(){
41
44
  return this.app;
42
45
  }
46
+ getServer(){
47
+ return this.server;
48
+ }
43
49
  }
@@ -64,7 +64,7 @@ export async function createUser(data:UserCreateInterface):Promise<any>{
64
64
  }
65
65
  }
66
66
 
67
- export async function changeUserPassword(email:string,password:string){
67
+ export async function changeUserPassword(email:string,password:string):Promise<User>{
68
68
  try{
69
69
  let user=await User.findOne({where:{email}});
70
70
  if(!user)