Enhance Code - Add jwt auth, typescript, documentation, testing (TDD)#6
Enhance Code - Add jwt auth, typescript, documentation, testing (TDD)#6pakeku wants to merge 79 commits into
Conversation
Erick/update documentation
…erver and MongoDB connection using stopDatabase(). This improves stability in dev and production environments.
Erick/update documentation
update documentation
Migrate to ts
add auth middleware, correct type in git-username
update documentation
Documentation/swagger
remove type:module
remove console.error log
|
@johnny-rice forgot to make my PR some weeks ago. |
|
| @@ -0,0 +1,36 @@ | |||
| # 📦 .env.sample | |||
There was a problem hiding this comment.
Nice job adding an env sample
| # Dependency directories | ||
| node_modules/ | ||
| jspm_packages/ | ||
| package-lock.json |
There was a problem hiding this comment.
Sometimes good to have package lock committed so the CI can use it with the exact packages it was committed with. Recomend removing it from the ignore.
| @@ -0,0 +1,7 @@ | |||
| { | |||
| - Week 10: <https://github.com/SummerOfCode2020/week-10-store-manager-api> | ||
|
|
||
| - Week 12: <https://github.com/SummerOfCode2020/week-12-store-manager-api> | ||
| # Node.js and Express Backend |
There was a problem hiding this comment.
Wow - nicely improved version.
| @@ -0,0 +1,19 @@ | |||
| /** @type {import('ts-jest').JestConfigWithTsJest} */ | |||
| { | ||
| "name": "week-10", | ||
| "version": "1.0.0", | ||
| "name": "backend-api", |
| return; | ||
| } | ||
|
|
||
| const hashedPassword = await bcrypt.hash(password, 10); |
There was a problem hiding this comment.
This is great. 12 rounds could be a good way to go here.
| [](https://prettier.io/) | ||
| [](https://eslint.org/) | ||
| [](https://www.typescriptlang.org/) | ||
| [](http://localhost:3000/api-docs) |
There was a problem hiding this comment.
Could be good to specify local here since we have localhost hardcoded here.
johnny-rice
left a comment
There was a problem hiding this comment.
Great PR @pakeku !! This is a huge improvement to the aged project. Very nice modernization of the repo. These changes make it much more production ready than the old original.
✅ TypeScript conversion is clean and well structured
✅ JWT auth works well with solid tests
✅ Middleware and error handling are much more robust
✅ TDD setup with Jest + Supertest + in-memory DB is excellent
✅ Swagger docs + improved README are very helpful
✅ CI workflow is a great addition
Minor notes:
- In stores.ts, getStores() strips metadata from response. Just checking if this is intentional, since metadata is used in the update test.
- Store model vs HTTP test fields (store_profile, shipping_address) have some mismatch and could standardize.
Great work. Ready to approve once you confirm the small field consistency.
No description provided.