Browse Source

🔨 Change server port to 8000

Had issues with frontend on 6000
main
Haris Razis 4 years ago
parent
commit
8ab35b3c34
No known key found for this signature in database GPG Key ID: 86A4D290ED03FAB4
  1. 2
      client/config/keys.js
  2. 2
      docker-compose.yml
  3. 16
      server/index.js
  4. 5
      web/src/store/index.ts

2
client/config/keys.js

@ -1,3 +1,3 @@
module.exports = {
server_url: 'http://backend:6000'
server_url: 'http://backend:8000'
}

2
docker-compose.yml

@ -37,7 +37,7 @@ services:
max_attempts: 3
window: 120s
ports:
- "6000:6000"
- "8000:8000"
networks:
- backend
- frontend

16
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}!`));
});

5
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()
})

Loading…
Cancel
Save