diff --git a/README.md b/README.md index b98a7ba..f944d7c 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ -# twitter \ No newline at end of file +# twitter +DATABASE_URL = postgres://jopfbvotzylhye:cd9d1347c5c1bcf467f7f8525b8878d5656266dd32176b4461c585dc28a7314b@ec2-107-22-167-179.compute-1.amazonaws.com:5432/ddo2f7ukgcdbsu diff --git a/background.jpg b/background.jpg new file mode 100644 index 0000000..83bdeb9 Binary files /dev/null and b/background.jpg differ diff --git a/database/db_connection.js b/database/db_connection.js index 77d9a5b..f59671d 100644 --- a/database/db_connection.js +++ b/database/db_connection.js @@ -1,10 +1,10 @@ const {Pool} = require('pg'); require('env2')('./config.env'); - -if (!process.env.DATABASE_URL) { +const DB_URL = process.env.DATABASE_URL; // || 'postgres://kefah:kefah@localhost:5432/twitter'; +if (!DB_URL) { throw new Error('No DATABASE_URL provided'); } -const pool = new Pool({ connectionString: process.env.DATABASE_URL }); +const pool = new Pool({ connectionString: DB_URL }); module.exports = pool; diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..1f907dc Binary files /dev/null and b/favicon.ico differ diff --git a/public/css/style.css b/public/css/style.css index 4cf236d..05ac9aa 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,9 +1,161 @@ -*{ +* { padding: 0; margin: 0; } -.container{ + +.container { width: 100%; - max-width: 1200px; + max-width: 1200px;*/ margin: 0 auto; } + +.maincontent{ + background-color: red; +} +/******** BODY IMAGE ***************/ + +body{ + background: url(../background.jpg) no-repeat -300px -800px; +} + +/******** END BODY IMAGE **************/ +/************ START HEADER CSS **************/ +header { + height:70px; + background:#fff; + border:1px solid #CCC; +} + +a { + text-decoration: none; + +} +.branding img { + float: left; + width: 50px; + height: 50px; + padding: 10px; + padding-left: 50px; + padding-right: 1px; +} + +.branding h3 { + position: relative; + top: 18px; + left: 10px; + color: #1da1f2; + text-decoration: none; + padding-top: 8px; +} + +#userNav h3{ + + float: right; + top: 18px; + left: 10px; + color: #1da1f2; + text-decoration: none; + margin-right: 50px; + margin-bottom: 15px; + +} +/************ END HEADER CSS ************/ +/******** START LOGIN FORM CSS ********/ + +#loginSection{ + float: right; + background-color: yellow; + padding: 15px; + width: 300; + margin-right: 200px; + margin-top: 50px; + max-height: 500px; + +} + +form#loginForm button{ + height: 32px; + background:#FFFFFF; + /*border:5px;*/ + border-color: #1da1f2; + padding-left: 20px; + padding-right: 20px; + color: #1da1f2; + float: right; + border-radius: 20px; + font-weight: bold; +} + +form#loginForm button:hover{ + background-color: #eaf5fd; +} + +/*#newsletter form { + float: right; + margin-top: 15px; +}*/ +section#loginSection form input, section#signupSection form input { +width: 90%; +padding: 5px; +margin-bottom: 5px; + +} + +h3#loginh3{ + font-family: monospace ,sans-serif; + margin-bottom: 5px; +} + +/******** END LOGIN FORM CSS ********/ + +/********* START SIGNUP FORM CSS *****/ + +#signupSection{ + float: left; + padding: 15px; + width: 350px; + max-height: 500px; + margin-left: 150px; + margin-right: 50px; + margin-top: 50px; + border: 3px; +} + +form#signupForm button{ + height: 32px; + background:#1da1f2; + border:0; + padding-left: 20px; + padding-right: 20px; + color: #ffffff; + float: right; + border-radius: 20px; + font-weight: bold; +} + +/*#newsletter form { + float: right; + margin-top: 15px; +}*/ + +h3#signuph3{ + font-family: monospace ,sans-serif; + margin-bottom: 10px; +} + +form#signupForm button:hover{ + background-color: #006dbf; +} + +hr{ + color: #f4f6f9; + margin-bottom: 5px; +} +/********* END SIGNUP FORM CSS *******/ + +section#loginSection, section#signupSection{ + max-height: 500px; + max-width: 400px; + padding: 20px; + position: relative; +} diff --git a/public/index.html b/public/index.html index e8f7001..78a0f5f 100644 --- a/public/index.html +++ b/public/index.html @@ -7,35 +7,54 @@ + Twitter +
-
+
+
+

Login ...

+
+
+
+
+
+ +
+

New to Twitter? Sign up

+
+
+
diff --git a/tests/be_test.js b/tests/be_test.js index 0e49c1c..e69de29 100644 --- a/tests/be_test.js +++ b/tests/be_test.js @@ -1,48 +0,0 @@ -const getData = require('./queries/generic'); - -function test (query, cb) { - let obj = {}; - // const query = `SELECT teams.id AS team_id, teams.name AS team_name , teams.description AS team_description - // , memebers.name AS member_name , - // projects.id AS project_id , projects.title AS project_name , projects.state AS project_state FROM teams_members - // INNER JOIN memebers ON memebers.id = teams_members.member_id - // INNER JOIN teams ON teams.id = teams_members.team_id - // INNER JOIN projects ON projects.team_id = teams.id;`; - // const query = - getData(query, (err, res) => { - if (err) { - cb(err); - } else { - cb(null, res); - } - }); -} - -test('SELECT DISTINCT id , name , description FROM teams', (err, res) => { - if (err) { - console.log(err); - } else { - let ids = res.map((obj) => { - return {id: obj.id, name: obj.name, description: obj.description}; - }); - ids.map((team) => { - team.projects = []; - team.members = []; - test(`SELECT id , title , description , state FROM projects WHERE team_id=${team.id}`, (err, projectsRes) => { - if (err) { - console.log('in projects query', err); - } else { - team.projects = projectsRes; - test(`SELECT member_id , memebers.name FROM teams_members INNER JOIN memebers ON memebers.id = teams_members.member_id WHERE team_id=${team.id}`, (err, membersRes) => { - if (err) { - console.log('member query error', err); - } else { - team.members = membersRes; - console.log(team); - } - }); - } - }); - }); - } -}); diff --git a/tests/db.test.js b/tests/db.test.js index c8b9424..e69de29 100644 --- a/tests/db.test.js +++ b/tests/db.test.js @@ -1,29 +0,0 @@ -const connection = require('../database/db_connection.js'); -const test = require('tape'); - -test('Testing database connection', (t) => { - const sql = ''; - connection.query(sql, (err, res) => { - if (err) { - t.notOk(!err, err); - t.end(); - } else { - t.equal(res != null, true, 'Should not be empty'); - t.end(); - } - }); -}); - -test('Testing queries on the database', (t) => { - const sql = 'SELECT * FROM users'; - connection.query(sql, (err, res) => { - if (err) { - t.notOk(!err, err); - t.end(); - } else { - t.equal(res.rows.length, 2, 'Should not be empty'); - t.end(); - connection.end(); - } - }); -}); diff --git a/twitterlogo.png b/twitterlogo.png new file mode 100644 index 0000000..c042133 Binary files /dev/null and b/twitterlogo.png differ