Skip to content

Commit

Permalink
Merge pull request #46 from kolya-mazurok2/45-fix-endpoints-response
Browse files Browse the repository at this point in the history
Resolved #45
  • Loading branch information
kolya-mazurok2 committed Aug 13, 2022
2 parents ec12236 + b5af62a commit 8413c73
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/config/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'reflect-metadata';
import { DataSource } from 'typeorm';
import { City } from '../entities/city';
import { Forecast } from '../entities/forecast';
import { User } from '../entities/user';

interface PostgresConfig {
host: string;
Expand Down Expand Up @@ -32,7 +33,7 @@ export const dataSource = new DataSource({
type: 'postgres',
synchronize: true,
logging: false,
entities: [City, Forecast],
entities: [City, Forecast, User],
subscribers: [],
...postgresConfig,
});
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import express, { Application } from 'express';
import express, { Application, NextFunction, Request, Response } from 'express';
import morgan from 'morgan';
import { dataSource } from './config/database';
import router from './routes';
Expand All @@ -15,7 +15,9 @@ app.use(morgan('tiny'));

app.use(router);

app.use(apiErrorMiddleware);
app.use((err: Error, req: Request, res: Response, _: NextFunction) =>
apiErrorMiddleware(err, req, res)
);

(async () => {
try {
Expand Down
2 changes: 2 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Secret } from 'jsonwebtoken';

require('dotenv').config();

export const JWT_SECRET_KEY: Secret = process.env.JWT_SECRET_KEY || '';

0 comments on commit 8413c73

Please sign in to comment.