Last active
February 7, 2018 18:09
-
-
Save sashajustice/a728d2d07c85ce66c62286caceb1c40f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Overview | |
This week’s focus will be building a full stack to do list app. | |
Areas of Focus- Build fullstack apps on a weekly basis that can be used on a portfolio | |
FULLSTACK TODO LIST - pseudo code of order of work | |
1.BACK END | |
require pg promise on page | |
1. There is a function that gets all un-completed todos called getAllTodos | |
-const getAllTodos = (uncompleted) => { | |
2.There is a function that gets all completed todos called getCompletedTodos | |
const getCompletedTodos = () => { | |
return db.any(’SELECT | |
getCompletedTodos( ‘’) | |
.then(console.log) | |
.catch(console.error) | |
3.There is a function that marks a todo as completed called completeOneTodo | |
const completeOneTodo = () => { | |
return db.one(‘SELECT todo FROM | |
4. There is a function that adds a new todo called addOneTodo | |
const completeOneTodo = () => { | |
return db.one(`INSERT INTO | |
2.SCHEMA | |
CREATE SCHEMA WITH one table todos | |
todos table | |
id | |
description | |
is_completed BOOLEAN | |
3.MIDDLEWARES | |
express | |
routes. file | |
complete = app.post(‘/complete’, (request , response) => { | |
Add new todo = app.post(‘/add redirect’ | |
app.get(‘/‘ | |
app.get(‘/incomplete , (request, response) => { | |
question: /complete renders the completed page with all completed todos. | |
app.get(‘/completed, (request, response) | |
4.TESTING | |
One test on one function , using mocha chai | |
two views | |
home.pug = | |
render non-completed todos | |
each todo has a link that u can click to complete the todo | |
it has a form to add a new todo | |
completed todos = render completed todos | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment