diff --git a/.gitignore b/.gitignore index 24cdedf8..eb14a767 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ # misc .DS_Store +.env .env.local .env.development.local .env.test.local diff --git a/docker-compose.yaml b/docker-compose.yaml index b8666971..74428558 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,27 +1,34 @@ -version: "3.8" - -services: - account: - build: "src/account/" - command: "npm run account" - ports: - - "5000:5000" - env_file: "src/account/.env" - dns: - - "8.8.8.8" - routes: - build: "src/routes/" - command: "npx ts-node github.ts" - ports: - - "4000:4000" - - "8080:8080" - env_file: "src/routes/.env" -# client: -# build: "client/" -# command: "npm start" -# ports: -# - "3000:3000" -# env_file: ".env" -# # Requires server services to run before running client servers -# depends_on: -# - "server" + +version: "3.8" + +services: + # account: + # build: "src/account/" + # command: "npm run account" + # ports: + # - "5000:5000" + # env_file: "src/account/.env" + # dns: + # - "8.8.8.8" + models: + build: "src/models/" + command: "echo Models Container Working" + routes: + build: "src/routes/" + command: "npx ts-node github.ts" + ports: + - "4000:4000" + - "8080:8080" + env_file: "src/routes/.env" + depends_on: + - "models" + client: + build: "client/" + command: "npm start" + ports: + - "3000:3000" + env_file: "src/routes/.env" +# Requires server services to run before running client servers + depends_on: + # - "account" + - "routes" diff --git a/package-lock.json b/package-lock.json index c79f2499..6513973b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31401,4 +31401,4 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index b1621741..dfd70d04 100644 --- a/package.json +++ b/package.json @@ -26,4 +26,4 @@ "@types/mongoose": "^5.11.97", "@types/node": "^20.10.0" } -} +} \ No newline at end of file diff --git a/src/models/Dockerfile b/src/models/Dockerfile new file mode 100644 index 00000000..9833b49a --- /dev/null +++ b/src/models/Dockerfile @@ -0,0 +1,9 @@ +FROM node:latest + +WORKDIR /models + +# Copies files from the models directory +COPY ["DeviceSchema.ts", "/models"] +COPY ["UserSchema.ts", "/models"] + +RUN ["/bin/bash", "-c", "echo Models Image Built!"] diff --git a/src/routes/github.ts b/src/routes/github.ts index 3482c119..03159f6d 100644 --- a/src/routes/github.ts +++ b/src/routes/github.ts @@ -66,8 +66,7 @@ router.get("/github/callback", async (req: any, res: any) => { const user = await getUser({ code }); - console.log(user); - res.redirect("http://localhost:3000") + res.send(user); }) export {}; diff --git a/src/routes/routes.ts b/src/routes/routes.ts index 31c097b6..7fcf8dd4 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -1,41 +1,41 @@ const express = require("express"); -const User = require("../models/UserSchema") +// const User = require("../models/UserSchema"); export const router = express.Router() // Register method -router.post('/register', (req: any, res: any) => { - const user = new User({ - email:req.body.email, - name:req.body.name - }) - user.save(function (err: any, res: any) { - if (err) { - console.log(err) - } - else { - console.log(res) - } - }) -}) +// router.post('/register', (req: any, res: any) => { +// const user = new User({ +// email:req.body.email, +// name:req.body.name +// }) +// user.save(function (err: any, res: any) { +// if (err) { +// console.log(err) +// } +// else { +// console.log(res) +// } +// }) +// }) // Get all method // Get one method -router.post('/account', async (req: any, res: any) => { - User.find({}, function(err: any, users: any) { - let loginIn = false +// router.post('/account', async (req: any, res: any) => { +// User.find({}, function(err: any, users: any) { +// let loginIn = false - // Check if one of the users in the db is already present - // If so set that equal to flag, if not then indicate the user isn't registered - users.forEach(function(user: any) { - if (req.body.email === user.email) - loginIn = true - }); +// // Check if one of the users in the db is already present +// // If so set that equal to flag, if not then indicate the user isn't registered +// users.forEach(function(user: any) { +// if (req.body.email === user.email) +// loginIn = true +// }); - res.send({'success' : loginIn}); - }); -}) +// res.send({'success' : loginIn}); +// }); +// }) // Update one diff --git a/yarn.lock b/yarn.lock index 5f117607..d8011dc0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10591,4 +10591,4 @@ yn@3.1.1: yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" - integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== \ No newline at end of file