Skip to content

Commit

Permalink
Añadir puertos y cambiar workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
UO271728 committed May 1, 2022
1 parent 4bf8934 commit 5212ff3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pruebaDeploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI for ASW2122
on:
push:
branch: [Despliegue]
release:
types: [published]

jobs:
docker-push-webapp:
Expand Down
3 changes: 2 additions & 1 deletion restapi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ FROM node:16.13.1
LABEL org.opencontainers.image.source https://github.com/Arquisoft/dede_es2a
COPY . /app
WORKDIR /app
#Install the dependencies


#Install the dependencies
RUN npm install

CMD [ "npm", "start" ]
2 changes: 1 addition & 1 deletion restapi/routes/pedido.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pedidoRouter.get("/byUser/:user", async(req:Request,res:Response)=>{
res.send("El usuario no existe");
}
else{
var pedidos = await Pedido.find({"usuario":usuario._id});
var pedidos = await Pedido.find({"usuario":usuario._id}).populate("juguetes._id");
if(pedidos.length > 0){
res.send(pedidos);
}else{
Expand Down
8 changes: 4 additions & 4 deletions restapi/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import { pedidoRouter } from "./routes/pedido.router";
import { usuarioRouter } from "./routes/usuario.router";

const app: Application = express();
const port: number = 5000;
const port = process.env.PORT || 5000;


require('dotenv').config()
let bd = require('./modules/gestorDB')
let {config} = require('./modules/cloudinary');

const options: cors.CorsOptions = {
origin: ['http://localhost:3000']
//origin: ['https://dede-es2a-webapp.herokuapp.com']
//origin: ['http://localhost:3000']
origin: ['https://dede-es2a-webapp.herokuapp.com']
};

const metricsMiddleware:RequestHandler = promBundle({includeMethod: true});
Expand All @@ -27,7 +27,7 @@ app.use(metricsMiddleware);
bd.connect();
config();

app.use(cors());
app.use(cors(options));
app.use(bp.json());

app.use("/juguete", jugueteRouter);
Expand Down
2 changes: 1 addition & 1 deletion webapp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import express,{Application} from 'express';
//setting the option module to commonjs

var app: Application = express()
const port: number = 3000;
const port = process.env.PORT || 3000;

app.use(express.static('build'))

Expand Down

0 comments on commit 5212ff3

Please sign in to comment.