-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Geeksevent #41
base: master
Are you sure you want to change the base?
Geeksevent #41
Changes from all commits
6b6c5c6
7a4da75
574a83f
3d06918
41d671d
5ec9768
d1fa658
408df04
3fb9892
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
{ | ||
"name": "gsg_narrowcast", | ||
"version": "1.0.0", | ||
"description": "GSG Narrowcast", | ||
"main": "index.js", | ||
"description": "[![Build Status](https://travis-ci.org/FACG4/gsg_narrowcast.svg?branch=master)](https://travis-ci.org/FACG4/gsg_narrowcast) # GSG_Narrowcast: An app that allows you to quickly and effortlessly learn about all upcoming events held in GSG as well as understand what GSG does as an entity, what their main programs are and whether they interest you.", | ||
"main": ".eslintrc.js", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"dependencies": { | ||
"bcrypt": "^2.0.1", | ||
"env2": "^2.2.2", | ||
"express": "^4.16.3", | ||
"jsonwebtoken": "^8.3.0", | ||
"mongodb": "^3.0.10", | ||
"mongoose": "^5.1.6", | ||
"tap-spec": "^5.0.0", | ||
"tape": "^4.9.1" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^5.2.0" | ||
}, | ||
"scripts": { | ||
"start": "nodemon src/index.js", | ||
"test": "istanbul cover test/tests_index.js | tap-spec" | ||
"test": "tape test/tests_index.js | tap-spec", | ||
"start": "node ./src/index.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/FACG4/gsg_narrowcast.git" | ||
}, | ||
"author": "Abdallah, Ishak, Razan, Farah", | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/FACG4/gsg_narrowcast/issues" | ||
}, | ||
"homepage": "https://github.com/FACG4/gsg_narrowcast#readme", | ||
"devDependencies": { | ||
"eslint": "^4.19.1", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-plugin-import": "^2.12.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^5.2.0", | ||
"nodemon": "^1.17.5", | ||
"supertest": "^3.1.0", | ||
"tap-spec": "^5.0.0", | ||
"tape": "^4.9.1" | ||
}, | ||
"dependencies": { | ||
"env2": "^2.2.2", | ||
"express": "^4.16.3", | ||
"express-handlebars": "^3.0.0", | ||
"mongoose": "^5.1.5" | ||
} | ||
"homepage": "https://github.com/FACG4/gsg_narrowcast#readme" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
.EventPageBody{ | ||
background-image: url('gazageeks.JPG'); | ||
background-repeat: no-repeat; | ||
background-size: cover; | ||
} | ||
|
||
.addeventBtn{background-color: orange; | ||
border-radius: 10px; | ||
width: 200px; | ||
color: #47413d | ||
text-align: center; | ||
margin-left:50px; | ||
} | ||
|
||
.addeventBtn:hover{ | ||
background-color: rgb(43, 153, 188); | ||
color: white; | ||
} | ||
|
||
.Add-wrap { | ||
text-align: center; | ||
font-size: 20px; | ||
background-color: black; | ||
opacity: 0.8; | ||
width: 900px; | ||
margin-left: 430px; | ||
padding-bottom: 30px; | ||
padding-top: 30px; | ||
border-radius: 20px; | ||
|
||
} | ||
|
||
|
||
label{color: white; | ||
border-radius: 60px; | ||
text-align: center; | ||
} | ||
|
||
.addEventTitle{ | ||
color: white; | ||
font-weight: bolder; | ||
font-size: 50px; | ||
} | ||
|
||
.imageurl{ | ||
border-radius: 10px; | ||
text-align: center; | ||
margin-left:40px; | ||
margin-right: 40px; | ||
width: 300px; | ||
|
||
} | ||
|
||
.des{ | ||
margin-left:4px; | ||
} | ||
|
||
|
||
|
||
|
||
.des, .speaker, .title, .hall, .date, .start-date , .end-date{ | ||
border-radius: 10px; | ||
|
||
|
||
} | ||
.hall{ | ||
width: 300px; | ||
} | ||
.start-date , .end-date{ | ||
text-align: center; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const select = (selector) => | ||
document.querySelector(selector); | ||
const form = select('.dd-post'); | ||
const addeventBtn =select('.addeventBtn') | ||
; | ||
addeventBtn.addEventListener('click', function(event) { | ||
e.preventDefault(); | ||
var data = { | ||
title: select('.title').value, | ||
description:select('.des').value, | ||
speaker :select('.speaker ').value, | ||
hall: select('.hall').value, | ||
startDate: select('.start-date').value, | ||
endDate:select('end-date').value, | ||
ImageUrl:select('imageurl').value | ||
} | ||
|
||
fetch('/events', { | ||
headers: { | ||
'content-type': 'application/json' | ||
}, | ||
method: 'POST', | ||
body: data, | ||
}).then(function(res){ | ||
return res.json(); | ||
}).then(function(res){ | ||
console.log(res); | ||
}); | ||
|
||
}); | ||
|
||
var btn_form= select("#myBtn"); | ||
|
||
|
||
console.log(btn_form) | ||
btn_form.addEventListener("click", function (e) { | ||
|
||
|
||
|
||
|
||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const Events = require('../database/events'); | ||
|
||
exports.get = (req, res, next) => { | ||
res.render('event', {event: true, script: 'event_dom.js', title: 'My page' }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the |
||
} | ||
|
||
exports.post = (req, res, next) => { | ||
|
||
const schema = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Separate the queries from the controllers |
||
title: req.body.title, | ||
description: req.body.description, | ||
speaker:req.body.title, | ||
hall:req.body.hall, | ||
startDate:req.body.startDate, | ||
endDate:req.body.endDate | ||
|
||
} | ||
Events.create(schema) | ||
.then(docs=>{ | ||
res.end() | ||
}) | ||
.catch(err => { | ||
|
||
res.end() | ||
}) | ||
|
||
|
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const express = require('express'); | ||
|
||
const router = express.Router(); | ||
const event = require('./event') | ||
|
||
|
||
router.post('/event', event.post); | ||
router.get('/event', event.get); | ||
|
||
|
||
module.exports=router |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
const mongoose = require('mongoose'); | ||
require('env2')('./config.env'); | ||
|
||
const dbUrl = process.env.DB_URL; | ||
|
||
mongoose.connect(dbUrl); | ||
const dbConnection = mongoose.connection; | ||
dburl = 'mongodb://localhost/database' | ||
mongoose.connect(dburl); | ||
|
||
module.exports = { dbConnection }; | ||
module.exports = mongoose.connection; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const mongoose = require('mongoose') | ||
|
||
|
||
|
||
const eventSchema = mongoose.Schema({ | ||
startDate: Date, | ||
endDate: Date, | ||
title: String, | ||
hall: String, | ||
speaker: String, | ||
imageUrl: String, | ||
description: String, | ||
|
||
}); | ||
module.exports= mongoose.model('Events', eventSchema) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const mongoose = require('mongoose') | ||
|
||
const programSchema = mongoose.Schema({ | ||
title: { type: String, unique: true }, | ||
description: String, | ||
imageUrl: String, | ||
contactPerson: String, | ||
}); | ||
module.exports = mongoose.model('Programs', programSchema) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
const Events = require('../events.js'); | ||
|
||
const schema = { | ||
title: req.body.title, | ||
description: req.body.description, | ||
speaker:req.body.title, | ||
hall:req.body.hall, | ||
startDate:req.body.startDate, | ||
endDate:req.body.endDate | ||
|
||
} | ||
Events.create(schema) | ||
.then(docs=>{ | ||
res.end() | ||
}) | ||
.catch(err => { | ||
|
||
res.end() | ||
}) | ||
|
||
module.exports =schema ; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const Events = require('../events') | ||
|
||
module.exports = (object) => new Events({ object }).save(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good, you've created a query, and used it where? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. event.js in controller There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No you haven't required it in |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const mongoose = require('mongoose') | ||
|
||
const usersSchema = mongoose.Schema({ | ||
role: Number, | ||
username: { type: String, unique: true }, | ||
password: String, | ||
email: { type: String, unique: true }, | ||
}); | ||
module.exports = mongoose.model('Users' ,usersSchema); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
const app = require('./app'); | ||
|
||
/* eslint-disable no-console */ | ||
|
||
app.listen(app.get('port'), () => { | ||
console.log('this app runs on port', app.get('port')); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you requiring dbconnection in your
app
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
becuese i have a problem to save data i enter in the form in data base
its necessary to require dbconnection app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not. You shouldn't require your dbConnection in your app.