Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
changed correct port
Browse files Browse the repository at this point in the history
  • Loading branch information
nishkamittal committed Oct 14, 2024
1 parent f68b092 commit d0a7faf
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 40 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ RUN dotnet publish "./Chemistry Cafe API.csproj" -c $BUILD_CONFIGURATION -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Chemistry Cafe API.dll"]
ENTRYPOINT ["dotnet", "Chemistry Cafe API.dll"]

13 changes: 11 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ services:
- backend # Ensure the backend service starts before frontend
environment:
- ASPNETCORE_ENVIRONMENT=Development
- API_URL=http://backend:80 # This points to the backend service within the Docker network
- API_URL=http://backend:8080 # This points to the backend service within the Docker network
- ASPNETCORE_URLS=http://0.0.0.0:8080
networks:
- app-network


backend:
build:
context: . # Path to your back-end repository
dockerfile: Dockerfile
ports:
- "8080:80" # Map host port to container port
- "8080:8080" # Map host port to container port
environment:
- ASPNETCORE_ENVIRONMENT=Development
networks:
- app-network

networks:
app-network:
driver: bridge
4 changes: 2 additions & 2 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN npm install
COPY . .

# Expose the API port (e.g., 5000)
EXPOSE 5000
EXPOSE 5173

# Start the Node.js server
CMD ["npm", "run", "preview"]
CMD ["npm", "run", "dev"]
34 changes: 17 additions & 17 deletions frontend/src/API/API_GetMethods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export async function downloadOAJSON(tag_mechanism_uuid?: string){
if (!tag_mechanism_uuid) return "";

try {
const response = await axios.get(`http://localhost:5134/api/OpenAtmos/JSON/${tag_mechanism_uuid}`, {
const response = await axios.get(`http://localhost:8080/api/OpenAtmos/JSON/${tag_mechanism_uuid}`, {
responseType: 'text',
headers: {
'Content-Type': 'text/plain',
Expand All @@ -22,7 +22,7 @@ export async function downloadOAYAML(tag_mechanism_uuid?: string){
if (!tag_mechanism_uuid) return "";

try {
const response = await axios.get(`http://localhost:5134/api/OpenAtmos/YAML/${tag_mechanism_uuid}`, {
const response = await axios.get(`http://localhost:8080/api/OpenAtmos/YAML/${tag_mechanism_uuid}`, {
responseType: 'text',
headers: {
'Content-Type': 'text/plain',
Expand All @@ -37,7 +37,7 @@ export async function downloadOAYAML(tag_mechanism_uuid?: string){

export async function getFamilies(): Promise<Family[]> {
try {
const response = await axios.get<Family[]>(`http://localhost:5134/api/Family/all`);
const response = await axios.get<Family[]>(`http://localhost:8080/api/Family/all`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -47,7 +47,7 @@ export async function getFamilies(): Promise<Family[]> {

export async function getFamily(uuid?: string): Promise<Family> {
try {
const response = await axios.get<Family>(`http://localhost:5134/api/Family/${uuid}`);
const response = await axios.get<Family>(`http://localhost:8080/api/Family/${uuid}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -57,7 +57,7 @@ export async function getFamily(uuid?: string): Promise<Family> {

export async function getReactions(): Promise<Reaction[]> {
try {
const response = await axios.get<Reaction[]>(`http://localhost:5134/api/Reaction/all`);
const response = await axios.get<Reaction[]>(`http://localhost:8080/api/Reaction/all`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -67,7 +67,7 @@ export async function getReactions(): Promise<Reaction[]> {

export async function getReaction(uuid?: string): Promise<Reaction> {
try {
const response = await axios.get<Reaction>(`http://localhost:5134/api/Reaction/${uuid}`);
const response = await axios.get<Reaction>(`http://localhost:8080/api/Reaction/${uuid}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -79,7 +79,7 @@ export async function getReactionsFromTagMechanism(tag_mechanism_uuid?: string):
if (!tag_mechanism_uuid) return [];

try {
const response = await axios.get<Reaction[]>(`http://localhost:5134/api/Reaction/TagMechanism/${tag_mechanism_uuid}`);
const response = await axios.get<Reaction[]>(`http://localhost:8080/api/Reaction/TagMechanism/${tag_mechanism_uuid}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -89,7 +89,7 @@ export async function getReactionsFromTagMechanism(tag_mechanism_uuid?: string):

export async function getAllSpecies(): Promise<Species[]> {
try {
const response = await axios.get<Species[]>(`http://localhost:5134/api/Species/all`);
const response = await axios.get<Species[]>(`http://localhost:8080/api/Species/all`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -101,7 +101,7 @@ export async function getSpecies(uuid?: string): Promise<Species[]> {
if (!uuid) return [];

try {
const response = await axios.get<Species[]>(`http://localhost:5134/api/Species/${uuid}`);
const response = await axios.get<Species[]>(`http://localhost:8080/api/Species/${uuid}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -113,7 +113,7 @@ export async function getSpeciesFromTagMechanism(tag_mechanism_uuid?: string): P
if (!tag_mechanism_uuid) return [];

try {
const response = await axios.get<Species[]>(`http://localhost:5134/api/Species/TagMechanism/${tag_mechanism_uuid}`);
const response = await axios.get<Species[]>(`http://localhost:8080/api/Species/TagMechanism/${tag_mechanism_uuid}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -123,7 +123,7 @@ export async function getSpeciesFromTagMechanism(tag_mechanism_uuid?: string): P

export async function getTagMechanisms(): Promise<TagMechanism[]> {
try {
const response = await axios.get<TagMechanism[]>(`http://localhost:5134/api/TagMechanism/all`);
const response = await axios.get<TagMechanism[]>(`http://localhost:8080/api/TagMechanism/all`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -133,7 +133,7 @@ export async function getTagMechanisms(): Promise<TagMechanism[]> {

export async function getTagMechanism(uuid?: string): Promise<TagMechanism> {
try {
const response = await axios.get<TagMechanism>(`http://localhost:5134/api/TagMechanism/${uuid}`);
const response = await axios.get<TagMechanism>(`http://localhost:8080/api/TagMechanism/${uuid}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -145,7 +145,7 @@ export async function getTagMechanismsFromFamily(family_uuid?: string): Promise<
if (!family_uuid) return [];

try {
const response = await axios.get<TagMechanism[]>(`http://localhost:5134/api/TagMechanism/Family/${family_uuid}`);
const response = await axios.get<TagMechanism[]>(`http://localhost:8080/api/TagMechanism/Family/${family_uuid}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -155,7 +155,7 @@ export async function getTagMechanismsFromFamily(family_uuid?: string): Promise<

export async function getPropertyTypesFromValidation(validation: string): Promise<PropertyType[]> {
try {
const response = await axios.get<PropertyType[]>(`http://localhost:5134/api/PropertyType/Validation/${validation}`);
const response = await axios.get<PropertyType[]>(`http://localhost:8080/api/PropertyType/Validation/${validation}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -167,7 +167,7 @@ export async function getPropertiesFromParent(parent_uuid: string): Promise<Prop
if (!parent_uuid) return [];

try {
const response = await axios.get<PropertyVersion[]>(`http://localhost:5134/api/PropertyList/Properties/${parent_uuid}`);
const response = await axios.get<PropertyVersion[]>(`http://localhost:8080/api/PropertyList/Properties/${parent_uuid}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -179,7 +179,7 @@ export async function getReactantsFromReactionReactantList(reaction_reactant_lis
if (!reaction_reactant_list_uuid) return [];

try {
const response = await axios.get<ReactantProductList[]>(`http://localhost:5134/api/ReactantProductList/Reactants/${reaction_reactant_list_uuid}`);
const response = await axios.get<ReactantProductList[]>(`http://localhost:8080/api/ReactantProductList/Reactants/${reaction_reactant_list_uuid}`);
return response.data;
} catch (error) {
console.error(error);
Expand All @@ -191,7 +191,7 @@ export async function getProductsFromReactionReactantList(reaction_product_list_
if (!reaction_product_list_uuid) return [];

try {
const response = await axios.get<ReactantProductList[]>(`http://localhost:5134/api/ReactantProductList/Products/${reaction_product_list_uuid}`);
const response = await axios.get<ReactantProductList[]>(`http://localhost:8080/api/ReactantProductList/Products/${reaction_product_list_uuid}`);
return response.data;
} catch (error) {
console.error(error);
Expand Down
36 changes: 18 additions & 18 deletions frontend/test/API_GetMethods.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('API get functions tests', () => {
const result = await downloadOAJSON(tag_mechanism_uuid);

expect(mockedGet).toHaveBeenCalledWith(
`http://localhost:5134/api/OpenAtmos/JSON/${tag_mechanism_uuid}`,
`http://localhost:8080/api/OpenAtmos/JSON/${tag_mechanism_uuid}`,
{
headers: { 'Content-Type': 'text/plain' },
responseType: 'text',
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('API get functions tests', () => {
await expect(downloadOAJSON(tag_mechanism_uuid)).rejects.toThrow('Network error');

expect(axios.get).toHaveBeenCalledWith(
`http://localhost:5134/api/OpenAtmos/JSON/${tag_mechanism_uuid}`,
`http://localhost:8080/api/OpenAtmos/JSON/${tag_mechanism_uuid}`,
{
headers: { 'Content-Type': 'text/plain' },
responseType: 'text',
Expand All @@ -92,7 +92,7 @@ describe('API get functions tests', () => {
const result = await downloadOAYAML(tag_mechanism_uuid);

expect(mockedGet).toHaveBeenCalledWith(
`http://localhost:5134/api/OpenAtmos/YAML/${tag_mechanism_uuid}`,
`http://localhost:8080/api/OpenAtmos/YAML/${tag_mechanism_uuid}`,
{
headers: { 'Content-Type': 'text/plain' },
responseType: 'text',
Expand All @@ -107,7 +107,7 @@ describe('API get functions tests', () => {
const mockedGet = vi.spyOn(axios, 'get').mockResolvedValueOnce(createMockResponse()) as Mock;
const result = await getFamilies();

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/Family/all`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/Family/all`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -118,7 +118,7 @@ describe('API get functions tests', () => {
const uuid = 'valid-uuid';
const result = await getFamily(uuid);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/Family/${uuid}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/Family/${uuid}`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -127,7 +127,7 @@ describe('API get functions tests', () => {
const mockedGet = vi.spyOn(axios, 'get').mockResolvedValueOnce(createMockResponse()) as Mock;
const result = await getReactions();

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/Reaction/all`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/Reaction/all`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -138,7 +138,7 @@ describe('API get functions tests', () => {
const uuid = 'valid-uuid';
const result = await getReaction(uuid);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/Reaction/${uuid}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/Reaction/${uuid}`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -149,7 +149,7 @@ describe('API get functions tests', () => {
const tag_mechanism_uuid = 'valid-uuid';
const result = await getReactionsFromTagMechanism(tag_mechanism_uuid);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/Reaction/TagMechanism/${tag_mechanism_uuid}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/Reaction/TagMechanism/${tag_mechanism_uuid}`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -158,7 +158,7 @@ describe('API get functions tests', () => {
const mockedGet = vi.spyOn(axios, 'get').mockResolvedValueOnce(createMockResponse()) as Mock;
const result = await getAllSpecies();

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/Species/all`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/Species/all`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -169,7 +169,7 @@ describe('API get functions tests', () => {
const uuid = 'valid-uuid';
const result = await getSpecies(uuid);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/Species/${uuid}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/Species/${uuid}`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -180,7 +180,7 @@ describe('API get functions tests', () => {
const tag_mechanism_uuid = 'valid-uuid';
const result = await getSpeciesFromTagMechanism(tag_mechanism_uuid);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/Species/TagMechanism/${tag_mechanism_uuid}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/Species/TagMechanism/${tag_mechanism_uuid}`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -189,7 +189,7 @@ describe('API get functions tests', () => {
const mockedGet = vi.spyOn(axios, 'get').mockResolvedValueOnce(createMockResponse()) as Mock;
const result = await getTagMechanisms();

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/TagMechanism/all`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/TagMechanism/all`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -200,7 +200,7 @@ describe('API get functions tests', () => {
const uuid = 'valid-uuid';
const result = await getTagMechanism(uuid);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/TagMechanism/${uuid}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/TagMechanism/${uuid}`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -211,7 +211,7 @@ describe('API get functions tests', () => {
const family_uuid = 'valid-uuid';
const result = await getTagMechanismsFromFamily(family_uuid);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/TagMechanism/Family/${family_uuid}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/TagMechanism/Family/${family_uuid}`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -222,7 +222,7 @@ describe('API get functions tests', () => {
const validation = 'Species';
const result = await getPropertyTypesFromValidation(validation);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/PropertyType/Validation/${validation}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/PropertyType/Validation/${validation}`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -233,7 +233,7 @@ describe('API get functions tests', () => {
const parent_uuid = 'valid-uuid';
const result = await getPropertiesFromParent(parent_uuid);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/PropertyList/Properties/${parent_uuid}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/PropertyList/Properties/${parent_uuid}`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -244,7 +244,7 @@ describe('API get functions tests', () => {
const reactant_list_uuid = 'valid-uuid';
const result = await getReactantsFromReactionReactantList(reactant_list_uuid);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/ReactantProductList/Reactants/${reactant_list_uuid}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/ReactantProductList/Reactants/${reactant_list_uuid}`);
expect(result).toEqual(mockResponseData);
});

Expand All @@ -255,7 +255,7 @@ describe('API get functions tests', () => {
const reactant_list_uuid = 'valid-uuid';
const result = await getProductsFromReactionReactantList(reactant_list_uuid);

expect(mockedGet).toHaveBeenCalledWith(`http://localhost:5134/api/ReactantProductList/Products/${reactant_list_uuid}`);
expect(mockedGet).toHaveBeenCalledWith(`http://localhost:8080/api/ReactantProductList/Products/${reactant_list_uuid}`);
expect(result).toEqual(mockResponseData);
});
});

0 comments on commit d0a7faf

Please sign in to comment.