Commit a84cebac authored by Mohammed Ahmed's avatar Mohammed Ahmed

Initial commit

parents
Pipeline #5442 failed with stages
in 5 seconds

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
1.Readme file submitted?, 2. Is the URL of the app submitted and working? 3. Is the URL of gitlab repo submitted and working? 4. Is it a Node.js app? (requirement 1) other programming languages are not acceptable. -Complete
2.Requirement 2 Home page-Complete:(/views/index.html):File can be found in views/index.html. This contains all the HTML content of the main page including navigations to other pages.
3.Requirement 3 Register page-Complete:(/views/register.html):This contains the HTML content of the register page. When a users registers, the registered information after the validation checks is then stored in the listuserdb
4.Requirement 4 Login, test with the username you registered in requirement 3-Complete:(/views/login.html):This contains the login HTML content. When the form is filled, it checks the main.js and sees if we have a user called user1.
5.Requirement 5 Add food page-Complete:(/views/addfood.html):Html page whch has a form. When a logged in users adds food, it is stored into the ingridients database
6.Requirement 8 List page-Complete:(/views/list.html):This page list all food added to the ingridients database;
7.Requirement 11 database back-end, check list page, can you see recently added (or updated or deleted) food in the list page?-Complete:(/views/updatefood.html):this page includes two form which adds and removes and updated food from the daatabase;
8.Requirement 6 Update food page, test with the recipe you added in requirement 5, check list page and remark requirement 11 if necessary-Complete:(/views/updatefood.html):This HTML page can be found in the views folder. This page updates food. Code to updating can be found in main.js "app.post(updatefood)"
9.Requirement 7 Delete food page, test with the recipe you added in requirement 5, check list page and remark requirement 11 if necessary-Complete:(/views/updatefood.html):HTML page used to delte food. This is also linked to the update food form which is called when the user deletes food using the form
10.Requirement 9 form-validation, such as checking email address or length of password or username-Complete:(/routes/main.js):This can be found in the main.js. All forms have a "IsEmpty()" validation,IsLength() and isEmail() when Email is needed.
11.Requirement 10 suitable feedback messages to user when an operation is successful or unsuccessful-Complete:(/routes/main.js):Found in the main.js, All submission will include a output message to user display operation result.
12.Requirement 13 sessions, access control add, update and food pages are available only to logged-in users-Complete:(/routes/main.js)
13.Requirement 14 hashed password, check code in main.js file, search for 'bcrypt' and see if hashed password is saved in registered route in the database (insertOne function)-Complete:(/routes/main.js)
14.Requirement 15 Logout-Complete:(/routes/main.js)&&:(/views/logout.html):Logout can be found in views.html aswell as main.js
15.Requirement 16 api-Complete:(/routes/main.js);2 API's including the weather and food API
16.Requirement 17 link all pages to home page-Complete:All pages are linked by having navigation
17.
//we create our variables here. we acess our listuser data base aswell as my bookshop database. We assighnt variablres to a specific database for instance, url=mybookshop....ect
var express = require ('express')
var bodyParser= require ('body-parser')
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost/mybookshopdb";
var url2="mongodb://localhost/listusersdb";
var url3="mongodb://localhost/ingridients";
var session = require ('express-session');
var validator = require ('express-validator');
//when node index is run, it will output to the console"Database is Connected";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
console.log("Database created!");
db.close();
});
//this creates the user database and output to the console "User Database Created. This is to ensure all database are running propely
MongoClient.connect(url2, function(err, db) {
if (err) throw err;
console.log("User Database created!");
db.close();
});
//this displays "Food database created " to the console when application is running
MongoClient.connect(url3, function(err, db) {
if (err) throw err;
console.log("Food Database created!");
db.close();
});
const app = express()
const port = 8000
//
app.use(bodyParser.urlencoded({ extended: true }))
///added for session management
app.use(session({
secret: 'somerandomstuffs',
resave: false,
saveUninitialized: false,
cookie: {
expires: 600000
}
}));
////////////
// new code added to your Express web server
require('./routes/main')(app);
app.set('views',__dirname + '/views');
app.set('view engine', 'ejs');
app.engine('html', require('ejs').renderFile);
//////////////
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
../detect-libc/bin/detect-libc.js
\ No newline at end of file
../ejs/bin/cli.js
\ No newline at end of file
../jake/bin/cli.js
\ No newline at end of file
../mime/cli.js
\ No newline at end of file
../mkdirp/bin/cmd.js
\ No newline at end of file
../needle/bin/needle
\ No newline at end of file
../node-pre-gyp/bin/node-pre-gyp
\ No newline at end of file
../nopt/bin/nopt.js
\ No newline at end of file
../rc/cli.js
\ No newline at end of file
../rimraf/bin.js
\ No newline at end of file
../semver/bin/semver
\ No newline at end of file
../sshpk/bin/sshpk-conv
\ No newline at end of file
../sshpk/bin/sshpk-sign
\ No newline at end of file
../sshpk/bin/sshpk-verify
\ No newline at end of file
../uuid/bin/uuid
\ No newline at end of file
This software is dual-licensed under the ISC and MIT licenses.
You may use this software under EITHER of the following licenses.
----------
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
----------
Copyright Isaac Z. Schlueter and Contributors
All rights reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
# abbrev-js
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
Usage:
var abbrev = require("abbrev");
abbrev("foo", "fool", "folding", "flop");
// returns:
{ fl: 'flop'
, flo: 'flop'
, flop: 'flop'
, fol: 'folding'
, fold: 'folding'
, foldi: 'folding'
, foldin: 'folding'
, folding: 'folding'
, foo: 'foo'
, fool: 'fool'
}
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
module.exports = exports = abbrev.abbrev = abbrev