diff --git a/challenges/calculadora/Dockerfile b/challenges/calculadora/Dockerfile new file mode 100644 index 0000000..d91cc91 --- /dev/null +++ b/challenges/calculadora/Dockerfile @@ -0,0 +1,14 @@ +FROM node:14-alpine + +COPY . /app +WORKDIR /app +ENV PATH /app/node_modules/.bin:$PATH + +RUN yarn install +RUN yarn build +EXPOSE 3000 + +# +# This container needs to be runned in interactive mode (tty) +# +ENTRYPOINT ["yarn", "start", "PORT=3000"] \ No newline at end of file diff --git a/challenges/crud/backend/Dockerfile b/challenges/crud/backend/Dockerfile new file mode 100644 index 0000000..611919d --- /dev/null +++ b/challenges/crud/backend/Dockerfile @@ -0,0 +1,9 @@ +FROM node:14-alpine + +COPY . /app +WORKDIR /app + +RUN yarn install +EXPOSE 3004 + +ENTRYPOINT ["yarn", "start", "PORT=3004"] \ No newline at end of file diff --git a/challenges/crud/backend/src/controllers/BranchController.js b/challenges/crud/backend/src/controllers/BranchController.js index bd038da..0f585c2 100644 --- a/challenges/crud/backend/src/controllers/BranchController.js +++ b/challenges/crud/backend/src/controllers/BranchController.js @@ -11,7 +11,13 @@ module.exports = { }, async create(req, res) { - //#Erorr002155 + connection.table('branchs').insert({ nome: req.body['name'] }) + .then(() => { + res.status(200).json({ + status: 'success' + }); + }) + .catch(err => { console.log(err); throw err; }); }, async edit(req, res) { diff --git a/challenges/crud/backend/src/routes.js b/challenges/crud/backend/src/routes.js index f944127..9881062 100644 --- a/challenges/crud/backend/src/routes.js +++ b/challenges/crud/backend/src/routes.js @@ -4,10 +4,18 @@ const routes = express.Router(); const BranchController = require('./controllers/BranchController'); const CommitController = require('./controllers/CommitController'); -routes.get(/*'#Erroorrs12200009150'*/, /*#Erroorrs00009150*/); -routes.post(/*'#Erroorrs12200009150'*/, /*#Erroorrs00009150*/); +routes + .route('/branchs') + .get(BranchController.index) + .delete(BranchController.delete) + .post(BranchController.create) + .put(BranchController.edit); -routes.put(/*'#Erroorrs12200009150'*/, /*#Erroorrs00009150*/); -routes.delete(/*'#Erroorrs12200009150'*/, /*#Erroorrs00009150*/); +routes + .route('/commits') + .get(CommitController.index) + .delete(CommitController.delete) + .post(CommitController.create) + .put(CommitController.edit); module.exports = routes; \ No newline at end of file diff --git a/challenges/crud/frontend/Dockerfile b/challenges/crud/frontend/Dockerfile new file mode 100644 index 0000000..0979323 --- /dev/null +++ b/challenges/crud/frontend/Dockerfile @@ -0,0 +1,9 @@ +FROM node:14-alpine + +COPY . /app +WORKDIR /app + +RUN yarn install +EXPOSE 3000 + +ENTRYPOINT ["yarn", "start", "PORT=3000"] \ No newline at end of file