Skip to content

Commit

Permalink
Merge pull request #2 from Ramitsan/server
Browse files Browse the repository at this point in the history
fix server host
  • Loading branch information
Ramitsan authored Apr 24, 2024
2 parents 5e8fdc7 + 9acc255 commit bfc2bc3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion project/src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const StatusCodeMapping: Record<number, boolean> = {
const shouldDisplayError = (response: AxiosResponse) => !!StatusCodeMapping[response.status];

// const BACKEND_URL = 'https://10.react.pages.academy/six-cities';
const BACKEND_URL = 'http://localhost:3000';
// const BACKEND_URL = 'http://localhost:3000';
const BACKEND_URL = 'https://sixcities.inikon.online';
const REQUEST_TIMEOUT = 5000;

export const createAPI = (): AxiosInstance => {
Expand Down
2 changes: 1 addition & 1 deletion server/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
HOST=http://localhost
HOST=https://sixcities.inikon.online
PORT=3000
2 changes: 1 addition & 1 deletion server/src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface IComment {
const favorites: Record<string, number[]> = {};
const OFFER_FAVORITE_STATUS_TRUE = 1;
const OFFER_FAVORITE_STATUS_FALSE = 0;
const HOST = (process.env.HOST || 'http://localhost') + ':' + (process.env.PORT || 3000);
const HOST = process.env.HOST || ('http://localhost:' + (process.env.PORT || 3000));
@Controller()
export class AppController {
constructor(private readonly appService: AppService, private readonly authService: AuthService) {}
Expand Down
4 changes: 2 additions & 2 deletions server/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as dotenv from 'dotenv';
dotenv.config();
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as dotenv from 'dotenv';

async function bootstrap() {
dotenv.config();
const app = await NestFactory.create(AppModule, {cors: true});
await app.listen(process.env.PORT || 3000);
console.log(process.env.HOST, process.env.PORT);
Expand Down

0 comments on commit bfc2bc3

Please sign in to comment.