thunderwaste2's People
thunderwaste2's Issues
Project Definition
MVP
-
Define MVP
-
Basic Flowchart
-
Define views
-
Define models
-
Define routes
-
Define main configs app
-
Define Authentication
-
HTML/CSS - Fernando (Bootstrap)
GENERAL
-
Set milestones
-
Set Agenda
PRESENTATION
Structure
- Slide 1 - Title Slide: your project’s name & your name
- Slide 2 [+1] - Project Elevator Pitch: What is your project? How does it work? Why did you choose it?
- Slide 3 [+1] - Technical Challenge: What was the most important technical challenge you faced? How did you overcome that challenge?
- Slide 4 [+1] - Big Mistake: What was the biggest mistake you made during this project? What did you learn from it?
- Slide 5 - Demo Slide: with a link to your project so you can open it easily
- Slide 6 - Closing Slide: your project’s name, your name & a “Thank You”
MVP - Part 2
AF - 3
MVP - Part 1
Create App
- Create basic structure (folders/files)
- Install all dependencies (express, mongoose, body-parser, connect-flash, connect-mongo, hbs, multer, passport, passport-local, express-session, bcrypt, connect-ensure-login, cookie-parser) maybe: (morgan, debug)
- Create .env with the PORT and MONGODB_URI
- Require dotenv ->
require('dotenv').config();
- npm init
- create npm start and run dev in package.json (
"start": "node app.js", "dev": "nodemon app.js"
) - Require all dependencies in app.js
- add in layout.hbs:
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCp_GfKTh7jDVzfNW5aPuUb1RxlG6oNHls"></script>
- Connect to the database ( mongoose
.connect(‘mongodb://localhost/NAMEOFDATABASE’, { useNewUrlParser: true }) .then( x => console.log(
Connected to Mongo! Database name: “${x.connections[0].name}”)) .catch(err => console.error(‘Error connecting to Mongo’, err))
- add .gitignore with node_modules and .env
# Dependency directory
node_modules
# Environment Variables should NEVER be published
.env
Create models
- Users + add required, unique and validate fields (ex of validation:
const userSchema = new Schema ({ linkedinProfile: { type: String, validate: { validator: (text) => { return text.indexOf(‘https://www.linkedin.com/’) === 0; }, message: “linkedinProfile must start with ‘https://www.linkedin.com/’” } } };
) - Bookings
-
module.exports = MODELS
Seed the DB
- Create a simple seed.js to populate the DB -> array of objects + action
- close connection with Mongo (
mongoose.connection.close();
) - require Mongoose
- require Model
- connect to the DB
- start DB (node file)
- Check with Mongo
OTHER CONFIGS
- bodyParser:
app.use(bodyParser.urlencoded({ extended: true }));
- Passport:
passport.serializeUser((user, cb) => { cb(null, user._id); });
passport.deserializeUser((id, cb) => { User.findById(id, (err, user) => { if (err) { return cb(err); } cb(null, user); }); });
app.use(flash()); passport.use(new LocalStrategy({ passReqToCallback: true }, (req, username, password, next) => { User.findOne({ username }, (err, user) => { if (err) { return next(err); } if (!user) { return next(null, false, { message: "Incorrect username" }); } if (!bcrypt.compareSync(password, user.password)) { return next(null, false, { message: "Incorrect password" }); }
return next(null, user); }); }));
app.use(passport.initialize()); app.use(passport.session());
ROUTES
- Call all routes in index.js routes ->
const index = require(‘./routes/index’); app.use(‘/’, index);
INDEX ROUTES
- get /index
- get /materials-info
- get /home-user/id
- get /manager/id
- get /book-service/id
- post /book-service
- get /profile/id
- get /edit/id
- get /mgmt/profile/id
- get /mgmt/edit/id
- post /mgmt/edit
- get /mgmt/new
- post /mgmt/new
- get /mgmt/users
- get/mgmt/users/edit/id
- post /mgmt/users/edit
AUTH ROUTES
- Create folder
- Create file
- Route GET Signup
- Route POST Signup
- Route GET Login
- Route POST Login
- require bcrypt
- set bcryptSalt = 10
- SIGNUP check Username and Password
- findOne(username) -> if null, create new user (
const salt = bcrypt.genSaltSync(bcryptSalt); const hashWord = bcrypt.hashSync(password, salt);
), else, render error - LOGIN check Username and Password
- configure sessions ->
app.use(session({ secret: "basic-auth-lab", cookie: { maxAge: 60000 }, store: new MongoStore({ mongooseConnection: mongoose.connection, ttl: 24 * 60 * 60 // 1 day })
- Add error messages -> flash
- Create logout route
VIEWS
- Home:
Links: Login, Signup and Materials Info.
Page will have infos about our service + coverage map - Signup form - fields: Company's name, CNPJ, Address, Phone Number, Company's sector, Username, Email and Password
- Login form - fields: username and password
- Materials Info
Page will contain infos about all different types of recyclable materials - Home Client
Where client will land when they log in
Links: Logout, Profile > Edit, Book service - Book service form - fields: Date & Time (+ restrictions), Recyclable material, Quantity, Contact/ Responsible person and Address (only to confirm or reject)
- User Profile
Show all infos they've filled when signing up - User Edit
They can edit all infos about them except CNPJ. - Home Mgmt
Page will cointain the upcoming bookings and some infos
Links: Logout, Profile > Edit, Create a new MGMT account, Delete/Edit users - Manager Profile
All infos about the managers - Edit Profile
They can edit all fields - Add Manager
Form to create a new manager - Users list
All clients in our database - Users profile
We can see all clients' profiles - Edit users
A form to edit users or delete their accounts
AF - 2
AF - 1
FEATURES
- Google Social Login
- Quantity restriction - Companies
- Sign Up Approval
- Cooperatives map
SEED
- Cooperatives
MODELS
- Signup - add quantity in the model
- Signup - add field ACTIVE -> default = false
- Cooperatives - name, address, location, phone, more? active?
VIEWS
- Email - form (login creation)
- Email - message view (login creation)
- Signup - add form field quantity
- Employees - login request that will change ACTIVE status to true
- Cooperatives - map with pins showing where they are located
- Cooperatives - employees manage list (CRUD)
- Signup - add photo field
ROUTES
- Email - /send-email route (login creation)
- Email get form
- Email get message
- Change login status
- show cooperatives list
- CRUD cooperatives
- Edit route saving user model
CONFIGS
- Install nodemail
- Google Social Login Access
- Add Google keys in the .env
- Map
- Pins
- Local API
- Multer
- Cloudify
WHATELSE TO DO WITH GOOGLE?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.