diff --git a/client/config/keys.js b/client/config/keys.js index b4c4110..b7702b7 100644 --- a/client/config/keys.js +++ b/client/config/keys.js @@ -1,3 +1,3 @@ module.exports = { - server_url: 'http://backend:6000' + server_url: 'http://backend:8000' } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 7b379c7..f37ee05 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,7 +37,7 @@ services: max_attempts: 3 window: 120s ports: - - "6000:6000" + - "8000:8000" networks: - backend - frontend diff --git a/server/index.js b/server/index.js index 8e780a8..5fe5445 100644 --- a/server/index.js +++ b/server/index.js @@ -1,16 +1,19 @@ const app = require('express')() const server = require('http').createServer(app); const bodyParser = require('body-parser'); -const passport = require('./services/passport'); const chalk = require('chalk') const cors = require('cors') + require('./services/socket')(server); +require('./connections/mongo_conn'); const dataRoute = require('./routes/data') -const authRoute = require('./routes/data') +const authRoute = require('./routes/auth') + +const passport = require('./services/passport'); const {session_secret} = require('./config/keys'); -//allow for all requests for development. +//allow all requests for development. app.use(cors()) app.use(bodyParser.urlencoded({ @@ -28,8 +31,9 @@ app.use(passport.initialize(undefined)); app.use(passport.session(undefined)); app.use(dataRoute) -app.use('/api', authRoute) +app.use(authRoute) -server.listen(6000, () => { - console.log(chalk.green.bold('Server listening on port 6000!')); +const PORT = process.env.PORT || 8000; +server.listen(PORT, () => { + console.log(chalk.green.bold(`Server listening on port ${PORT}!`)); }); diff --git a/web/src/store/index.ts b/web/src/store/index.ts index 834c645..acab2cd 100644 --- a/web/src/store/index.ts +++ b/web/src/store/index.ts @@ -22,9 +22,9 @@ export default createStore({ actions: { login({commit}, user: { username: string, password: string }) { return new Promise((resolve, reject) => { - axios({url: 'http://backend:6000/api/auth/login', data: {user}, method: 'POST'}) + axios({url: 'http://localhost:8000/auth/login', data: {user}, method: 'GET'}) .then((resp: AxiosResponse) => { - commit("auth_success", user.username); + commit("auth_success", user); resolve(resp) }) .catch((err: Error) => { @@ -35,7 +35,6 @@ export default createStore({ }, logout({commit}) { return new Promise((resolve, reject) => { - let user = null; commit("logout"); resolve() })