diff --git a/.gitignore b/.gitignore index abcb50b..03b3ebe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,5 @@ node_modules -/hot -src/config/setup.js public/js/main.js.map public/js/main.js -server/data/data.json /dump.rdb -app.env +app.env \ No newline at end of file diff --git a/public/images/1529559724734_image1.jpeg b/public/images/1529559724734_image1.jpeg deleted file mode 100644 index 0817690..0000000 Binary files a/public/images/1529559724734_image1.jpeg and /dev/null differ diff --git a/public/images/1529559826728_image2.jpeg b/public/images/1529559826728_image2.jpeg deleted file mode 100644 index f9d17d9..0000000 Binary files a/public/images/1529559826728_image2.jpeg and /dev/null differ diff --git a/public/images/1529560008596_image1.jpeg b/public/images/1529560008596_image1.jpeg deleted file mode 100644 index 0817690..0000000 Binary files a/public/images/1529560008596_image1.jpeg and /dev/null differ diff --git a/public/images/1529560137444_image2.jpeg b/public/images/1529560137444_image2.jpeg deleted file mode 100644 index f9d17d9..0000000 Binary files a/public/images/1529560137444_image2.jpeg and /dev/null differ diff --git a/public/images/image01.jpg b/public/images/image01.jpg new file mode 100644 index 0000000..11e2442 Binary files /dev/null and b/public/images/image01.jpg differ diff --git a/public/images/image02.png b/public/images/image02.png new file mode 100644 index 0000000..bfb23cb Binary files /dev/null and b/public/images/image02.png differ diff --git a/public/images/image03.jpg b/public/images/image03.jpg new file mode 100644 index 0000000..67e1cfc Binary files /dev/null and b/public/images/image03.jpg differ diff --git a/public/images/image04.jpg b/public/images/image04.jpg new file mode 100644 index 0000000..4f733f4 Binary files /dev/null and b/public/images/image04.jpg differ diff --git a/public/images/image05.jpeg b/public/images/image05.jpeg new file mode 100644 index 0000000..8abfc14 Binary files /dev/null and b/public/images/image05.jpeg differ diff --git a/public/index.html b/public/index.html index 9b7b3e2..db21197 100644 --- a/public/index.html +++ b/public/index.html @@ -2,7 +2,7 @@ Meet-Up - +
diff --git a/server/model/redis.js b/server/model/redis.js index d06133a..0db1332 100644 --- a/server/model/redis.js +++ b/server/model/redis.js @@ -2,7 +2,7 @@ const redis = require('redis') const url = require('url') const {promisify} = require('util') -const redisURL = url.parse('redis://rediscloud:nW2uWZSh6dFJpKfDjqqkoRWCKOv5OEUD@redis-17508.c44.us-east-1-2.ec2.cloud.redislabs.com:17508') +const redisURL = url.parse(process.env.REDISCLOUD_URL) const client = redis.createClient(redisURL.port, redisURL.hostname, {no_ready_check: true}) client.auth(redisURL.auth.split(':')[1]) @@ -20,5 +20,5 @@ const smembers = promisify(client.smembers).bind(client) const lpop = promisify(client.lpop).bind(client) module.exports = { - hmset, hget, lpush, lrange, lset, sadd, smembers, lpop + hmset, hget, lpush, lrange, lset, sadd, smembers, lpop, redisURL, client } diff --git a/server/server.js b/server/server.js index c59a533..47bb109 100644 --- a/server/server.js +++ b/server/server.js @@ -1,8 +1,7 @@ const express = require('express') const bodyParser = require('body-parser') -const redis = require('redis') +const Redis = require('./model/redis') const fs = require('fs') -const client = redis.createClient() const session = require('express-session') const RedisStore = require('connect-redis')(session) const multer = require('multer') @@ -13,7 +12,7 @@ const comment = require('./controller/comment') const admin = require('./controller/admin') const app = express() -const PORT = 3000 +const PORT = process.env.PORT || 3000 const UPLOAD_DIR = './public/images' const storage = multer.diskStorage({ @@ -21,7 +20,7 @@ const storage = multer.diskStorage({ callback(null, UPLOAD_DIR) }, filename: function (req, file, callback) { - callback(null, Date.now() + '_' + file.originalname) + callback(null, file.originalname) } }) @@ -39,7 +38,7 @@ const upload = multer({ storage }) app.use(session({ secret: 'ssshhhhh', - store: new RedisStore({host: 'localhost', port: 6379, client: client, ttl: 260}), + store: new RedisStore({host: Redis.redisURL.hostname, port: Redis.redisURL.port, client: Redis.client, ttl: 260}), saveUninitialized: false, resave: false })) diff --git a/src/components/admin/admin.js b/src/components/admin/admin.js index a8cd5ca..f2a57db 100644 --- a/src/components/admin/admin.js +++ b/src/components/admin/admin.js @@ -2,7 +2,6 @@ import React, {Component} from 'react' import {Route, Redirect} from 'react-router-dom' import DashBoard from './dashboard' import EventForm from '../eventForm' -import config from '../../config/index' import http from '../../helper/http' class Admin extends Component { @@ -16,7 +15,7 @@ class Admin extends Component { } componentDidMount () { - http.post(`${config.url}api/admin/validate`, {'a': 'b'}) + http.post(`api/admin/validate`, {'a': 'b'}) .then((response) => { if (response.status === 200) { this.setState({isAuthenticated: true}) diff --git a/src/components/eventComments/comments.js b/src/components/eventComments/comments.js index fa2b613..d7a3781 100644 --- a/src/components/eventComments/comments.js +++ b/src/components/eventComments/comments.js @@ -3,7 +3,6 @@ import TextArea from '../../shared/textarea' import Button from '../../shared/button' import http from '../../helper/http' import moment from 'moment' -import config from '../../config/index' class Comments extends Component { constructor (props) { @@ -29,7 +28,7 @@ class Comments extends Component { const obj = {message, email: profile.email, eventId} - http.post(`${config.url}api/event/comment`, obj) + http.post(`api/event/comment`, obj) .then((response) => { if (response.status === 200) { this.handleReset() @@ -50,7 +49,7 @@ class Comments extends Component { const {eventId, eventDetails} = this.props const obj = {commentId: comment.commentId, eventId} - http.delete(`${config.url}api/event/comment`, obj) + http.delete(`api/event/comment`, obj) .then((response) => { eventDetails() }) diff --git a/src/components/eventContainer/eventcontainer.js b/src/components/eventContainer/eventcontainer.js index 2cb3bbb..402723e 100644 --- a/src/components/eventContainer/eventcontainer.js +++ b/src/components/eventContainer/eventcontainer.js @@ -2,7 +2,6 @@ import React, {Component} from 'react' import Carousel from '../../shared/carousel' import EventList from './eventList' import EventCard from '../eventCard' -import config from '../../config/index' import http from '../../helper/http' class EventContainer extends Component { @@ -15,7 +14,7 @@ class EventContainer extends Component { } componentDidMount () { - http.get(`${config.url}api/event`) + http.get(`api/event`) .then(response => response.json()) .then((events) => { this.setState({events}) diff --git a/src/components/eventDetails/eventdetails.js b/src/components/eventDetails/eventdetails.js index 5df1e8b..34533d7 100644 --- a/src/components/eventDetails/eventdetails.js +++ b/src/components/eventDetails/eventdetails.js @@ -6,7 +6,6 @@ import Description from '../eventDescription/description' import Attendees from '../eventAttendees/attendees' import Comments from '../eventComments/comments' import http from '../../helper/http' -import config from '../../config/index' import PopUp from '../../shared/popup' import GoogleOauth from '../googleOauth' import EventConfirm from './eventconfirm' @@ -31,7 +30,7 @@ class EventDetails extends Component { } getEventDetails () { - http.get(`${config.url}api/event/${this.props.match.params.id}`) + http.get(`api/event/${this.props.match.params.id}`) .then(response => response.json()) .then((event) => { const {isLocationLoaded} = this.state @@ -67,7 +66,7 @@ class EventDetails extends Component { let {profile} = this.props if (profile.email) { this.props.handleYes(false) - this.handleAttendee(profile, this.state.event.id, `${config.url}api/event/attendee`) + this.handleAttendee(profile, this.state.event.id, `api/event/attendee`) } } @@ -92,7 +91,7 @@ class EventDetails extends Component { handleCancelButtonClick () { const {profile, handleYes} = this.props handleYes(false) - this.handleAttendee(profile, this.state.event.id, `${config.url}api/event/attendee/cancel`) + this.handleAttendee(profile, this.state.event.id, `api/event/attendee/cancel`) } handleCloseClick () { @@ -109,7 +108,7 @@ class EventDetails extends Component { const {event} = this.state const list = event.attendees.filter((attendee) => attendee.email === this.props.profile.email)[0] if (!list && this.props.profile.email) { - this.handleAttendee(this.props.profile, event.id, `${config.url}api/event/attendee`) + this.handleAttendee(this.props.profile, event.id, `api/event/attendee`) } this.props.handleYes(false) } diff --git a/src/components/eventForm/eventform.js b/src/components/eventForm/eventform.js index d79280d..cb5c4a9 100644 --- a/src/components/eventForm/eventform.js +++ b/src/components/eventForm/eventform.js @@ -3,7 +3,6 @@ import {Redirect} from 'react-router-dom' import Button from '../../shared/button' import Input from '../../shared/input' import TextArea from '../../shared/textarea' -import config from '../../config/index' import DatePicker from 'react-datepicker' import moment from 'moment' import 'react-datepicker/dist/react-datepicker.min.css' @@ -77,7 +76,7 @@ class EventForm extends Component { formData.append('dateTime', date) id && formData.append('id', id) - fetch(`${config.url}api/event`, { + fetch(`api/event`, { method: isEditMode ? 'PUT' : 'POST', credentials: 'same-origin', body: formData diff --git a/src/components/googleOauth/googleOauth.js b/src/components/googleOauth/googleOauth.js index bf75214..e3b7ffb 100644 --- a/src/components/googleOauth/googleOauth.js +++ b/src/components/googleOauth/googleOauth.js @@ -22,7 +22,7 @@ class GoogleOauth extends Component { init () { const params = { - client_id: '689254462441-12m3gtb3llr27d4u4pvf6n0je55h24lf.apps.googleusercontent.com', + client_id: '842270765197-nobt2hcf8gqnkt63tqmk2ist1cdfefms.apps.googleusercontent.com', cookie_policy: 'single_host_origin', fetch_basic_profile: true, ux_mode: 'popup', diff --git a/src/components/logout/logout.js b/src/components/logout/logout.js index 096c72f..3a8afe2 100644 --- a/src/components/logout/logout.js +++ b/src/components/logout/logout.js @@ -1,7 +1,6 @@ import React, {Component} from 'react' import {withRouter} from 'react-router-dom' import Button from '../../shared/button' -import config from '../../config/index' import http from '../../helper/http' class Logout extends Component { @@ -18,7 +17,7 @@ class Logout extends Component { } onClick () { - http.delete(`${config.url}api/user/logout`, {}) + http.delete(`api/user/logout`, {}) .then(() => { console.log('logout') this.signOut() diff --git a/src/components/mainContainer/main.js b/src/components/mainContainer/main.js index 880aa38..ca00415 100644 --- a/src/components/mainContainer/main.js +++ b/src/components/mainContainer/main.js @@ -3,7 +3,6 @@ import { HashRouter, Route, Switch } from 'react-router-dom' import Content from '../content' import Header from '../header' import EventDetails from '../eventDetails' -import config from '../../config/index' import http from '../../helper/http' import Admin from '../admin' import Profile from '../profile' @@ -42,7 +41,7 @@ class Main extends Component { display: true, aboutme: '' } - http.post(`${config.url}api/user/get`, data) + http.post(`api/user/get`, data) .then(response => { response.json().then(profileinfo => { if (profileinfo === null) { diff --git a/src/components/profile/profile.js b/src/components/profile/profile.js index d8a68e6..f14a9e4 100644 --- a/src/components/profile/profile.js +++ b/src/components/profile/profile.js @@ -3,7 +3,6 @@ import {Redirect} from 'react-router-dom' import Button from '../../shared/button' import Input from '../../shared/input' import TextArea from '../../shared/textarea' -import config from '../../config/index' import http from '../../helper/http' class Profile extends Component { @@ -26,7 +25,7 @@ class Profile extends Component { aboutme: e.target.aboutme.value, display: this.state.checkbox }) - http.post(`${config.url}api/user/login`, data) + http.post(`api/user/login`, data) .then((response) => { if (response.status === 200) { this.props.handleFirst() diff --git a/src/config/index.js b/src/config/index.js deleted file mode 100644 index 1f3fd8f..0000000 --- a/src/config/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - 'url': 'http://localhost:3000/' -}