Skip to content
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

Project 2 - MVP / Soft Launch #50

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@

# Created by https://www.gitignore.io/api/node,macos

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env


# End of https://www.gitignore.io/api/node,macos
77 changes: 42 additions & 35 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,65 +1,72 @@
# Your Project Name
# Project 2: DoAP

This is the starter code for WDI projects. Please update this README file with information specific to your project. Replace this paragraph for instance, with a short description of your project. Then update the sections below. Refer to your project specificaion for instructions on how to submit your projects.
DoAP is a website designed for the dog-owners / lovers to post photographs of their dog pets.

## Getting Started
General public can report dog-fouling by uploading photograph and provide details for the relevant department to investigate. This is to promote and encourage social community engagement to help maintain better surrounding and environment.

Provide instructions here about how to get your project running on our local machine. Do we just need to clone and open a certain file or do we need to install anything first.
Link: https://p2-doap.herokuapp.com

### Prerequisites
---
## Getting Started / Installation

What is needed to install and run the project, how do we install them

```
Code example
Install the dependencies and start the server.
```sh
$ yarn install
$ nodemon
```
---
## Work Flow

### How to Use
### User Stories

A step by step guide on how to install and use the project, for example if this is a game, how do we play it.
![user stories](https://user-images.githubusercontent.com/31798170/34513245-4bd5b3ea-f0a2-11e7-93c5-c61edfb76abe.png)
<!-- <p align="center"><img src="./public/readme_img/User-Stories.png"></p> -->

### ERD

```
Code example
```
![erd](https://user-images.githubusercontent.com/31798170/34835477-e600e94c-f72f-11e7-9fae-ebe7d4483e9b.png)

More steps...
### Flowchart

```
until finished
```
![flowchart](https://user-images.githubusercontent.com/31798170/34835298-5fa8d8be-f72f-11e7-8951-9bc8b14f6ac0.png)

### Wireframe

## Tests
![wireframe](https://user-images.githubusercontent.com/31798170/34469465-7264461e-ef5a-11e7-8d84-6d7802e84b31.png)

Did you write automated tests? If so, how do we run them.
### Wireframe – Login Form

![wireframe-form](https://user-images.githubusercontent.com/31798170/34469467-7faadcde-ef5a-11e7-8b1d-0e5868b4accf.png)

```
Code example
```
### Mockup

## Live Version
![mockup - landing page](https://user-images.githubusercontent.com/31798170/34835083-c69afc38-f72e-11e7-8f9d-733d90cd7874.jpg)
![mockup - sign up](https://user-images.githubusercontent.com/31798170/34835102-d5427c48-f72e-11e7-9edc-50ded89a0ac9.jpg)
![mockup - contact us](https://user-images.githubusercontent.com/31798170/34835051-b72214c6-f72e-11e7-9edd-c05bef42ae57.jpg)

Where is this deployed online (github pages, heroku etc), give us the link and any access details we need.
---
## Built With / Technology

## Built With
* Front-end: HTML, CSS, Javascript, jQuery
* Back-end: Express, Node.js, Mongoose, MongoDB, Passport
* CSS Framework: Kube

What did you use to build it, list the technologies, plugins, gems, packages etc.
---

* [jQuery](http://jquery.com/) - jQuery for example is something you likely used
## Deployment & Versioning

## Workflow
* Github
* Heroku

Did you write user stories, draw wireframes, use task tracking, produce ERDs? Did you use source control, with regular commits? Include links to them here.
---

## Authors
## Possible Improvement / Scalable Areas

Did you collaborate with others on this project, list them here
* Able to shop online for pet waste pick-up items
* Able to book appointments for the vet clinics and grooming places

* **John McClain** - *Responsible for keeping vests white* - [GithubUserName](https://github.com/GithubUserName)
---

## Acknowledgments

* Hat tip to anyone who's code was used, for example [this was a useful starting point for creating this template](https://gist.github.com/PurpleBooth/109311bb0361f32d87a2).

* Image Sources: Christopher Harris, Matt Odell
151 changes: 151 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
// Module Dependencies ==========================================================================
const bodyParser = require('body-parser') // read the form, access POST requests
const cookieParser = require('cookie-parser') // read cookie file for auth
const express = require('express')
const app = express() // init App
const session = require('express-session') // connect flash to display message (encrypt)

const MongoStore = require('connect-mongo')(session);
const expressValidator = require('express-validator') // validate form
const methodOverride = require('method-override'); // access PUT / DELETE
const bcrypt = require('bcrypt')

const mongoose = require('mongoose') // write to database using schema
const exphbs = require('express-handlebars')
const path = require('path') // working with public file and directory path

const multer = require('multer')


// // Set Storage Engine ====================================================================
// const storage = multer.diskStorage ({
// destination: './public/uploads/',
// filename: function(req, file, cb){
// cb(null,file.fieldname + '-' + Date.now() + path.extname(file.originalname));
// }
// });

// // Init Upload
// const upload = multer ({
// storage: storage,
// limits:{fileSize: 1000000},
// fileFilter: function(req, file, cb){
// checkFileType(file, cb);
// }
// }).single('myImage');

// // Check File Type
// function checkFileType(file, cb){

// // Allowed extension
// const filetypes = /jpeg|jpg|png|gif/;

// // Check extension
// const extname = filetypes.test(path.extname(file.originalname).toLowerCase());

// // Check mime
// const mimetype = filetypes.test(file.mimetype);

// if(mimetype && extname){
// return cb(null,true);
// } else {
// cb('Error: Images Only!');
// }
// }


// Set Port ======================================================================================
const flash = require('connect-flash')
const passport = require('passport')
const port = process.env.PORT || 3013

const dbConfig = require('./config/dbConfig')


// Models - Routes ================================================================================
const routes = require('./routes/routes') // const is defined, cannot be re-assigned


// Configuration ================================================================================

// ----- Connect to Database -----
mongoose.Promise = global.Promise
mongoose.connect(dbConfig.url, {
useMongoClient : true }).then(() => {
console.log("-- Mongoose ok ---")},
(err) => { console.log(err) });


// ------ Set Up Express Application / Body-Parser Middleware -----
app.use(cookieParser()); // read cookies (needed for auth)
app.use(bodyParser.json())// get information from html forms
app.use(bodyParser.urlencoded({ extended: true }))


// ----- Set Static Path to Public Folder / View Engine -----
app.use(express.static(path.join(__dirname, 'public'))); // Store all HTML in view folders
app.engine('handlebars', exphbs({ defaultLayout: 'main'}));
app.set('view engine', 'handlebars');


// ----- Express Session To Track Logins -----
app.use(session({
name: 'doap',
secret: 'pp2',
resave: false,
saveUninitialized: true,
store: new MongoStore ({
url: dbConfig.url,
ttl: 00 * 00 * 00 * 10,
autoRemove: 'native'
}),
cookie: {
maxAge: 00 * 00 * 10 * 10 * 1000
}
}));

// ----- Passport -----
app.use(passport.initialize());
app.use(passport.session());


// ----- Connect Flash For Flash Messages Stored In Session -----
app.use(flash());


// Global Variances ==============================================================================
app.use((req, res, next) => {
res.locals.alerts = req.flash();
res.locals.currentUser = req.user;
next();
});


// Express Validator ==============================================================================
app.use(expressValidator({
errorFormatter: (param, msg, value) => {
let namespace = param.split('.')
, root = namespace.shift()
, formParam = root;

while(namespace.length) {
formParam += '[' + namespace.shift() + ']';
}

return {
param : formParam,
msg : msg,
value : value
};
}
}));

app.use(methodOverride('_method'));


// Routes ==================================================================================
app.use('/', routes);

app.listen(port, () => {
console.log('express-connected');
})
5 changes: 5 additions & 0 deletions config/dbConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
"url": "mongodb://p2emjys:wDi1320178@ds249727.mlab.com:49727/p2emjys"
}


Loading