hasankemaldemirci / task-app Goto Github PK
View Code? Open in Web Editor NEWA simple task manager to learn Node.js basics.
License: MIT License
A simple task manager to learn Node.js basics.
License: MIT License
Should NOT save empty object to database
Should NOT save task with empty description to database
Should ignore invalid fields in request
Should NOT save task with invalid completed property to database
Modify package.json -> test script
Add playground folder
Provide describe blocks
-Write test cases for scenarios below;
-Should calculate total when tip provided
-Should calculate total with .25 tip if tip not provided
-Should convert 32 F to 0 C
-Should convert 0 C to 32 F
Run tests in watch mode
vscode dotenv extension could be helpful
set PORT, MONGODB_URL for dev and test
Should save valid user to database
Should return correct user data in response
Should return 201 with valid user data
Should return 404 with valid object id that is not in database
Should return deleted task in response
Should return 500 with invalid object id
We should discuss about the tool to read env variables.
I just realized we're repeating same try-catch logic in all our endpoints.
Could be great if we can build a simple express error handler.
Save task to database
name: required
email: required, unique, lowercase, validate with validator library "Email is invalid"
password: min length 7, required, validate: "can not contain the word "password"'
age: validate: "must be a positive number"
Use bcryptjs library for hashing. Link to the library is below;
Success : 200, tasks array
Error: 500
When we send a request to task router endpoints but no matching task is not found, we always return 404 (Not Found) status code.
I suggest that we should change that to 204 (No Content) since our request is perfectly valid - no client error- but no data matches our criteria.
It will certainly affect some of our test cases, so they will need to be fixed as well if you agree with my suggestion of course. ๐ธ
Test cases to write;
add function
return new Promise((resolve, reject) => {
setTimeout(() => {
if(a < 0 || b < 0) {
return reject('Numbers must be non-negative')
}
resolve(a + b)
}, 500);
})
.catch(e => e)
}```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.