{"_id":"@100xdevs/assignment-1","_rev":"6-319994a910630e75176e95ee89c696fe","name":"@100xdevs/assignment-1","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.0":{"name":"@100xdevs/assignment-1","version":"1.0.0","description":"Convert this from JS to typescript.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC","dependencies":{"@types/cors":"^2.8.13","@types/express":"^4.17.17","@types/jsonwebtoken":"^9.0.2","@types/mongoose":"^5.11.97","cors":"^2.8.5","express":"^4.18.2","jsonwebtoken":"^9.0.1","mongoose":"^7.4.1","zod":"^3.21.4"},"gitHead":"9be90d05e818a4196e12506b0a211f1e943719f2","_id":"@100xdevs/assignment-1@1.0.0","_nodeVersion":"18.1.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-fLdW/ESjO/x1QluMc0pHKzgIN3G8tJFgNEqdGgz7nBrIva60Ge029YWf9yRgJ/JexOotbkQa1nVxRgsuFctfrw==","shasum":"0a67e3d577e8a72f42eb36780ffac64b8f436b26","tarball":"https://registry.npmjs.org/@100xdevs/assignment-1/-/assignment-1-1.0.0.tgz","fileCount":9,"unpackedSize":12359,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAEphUMtkcJgj75Mmoa2bIAvchGmLLXTvDP5pCT+8A7aAiBB6YB+0nTusCGHFoxtRRLknYrOr2CTnsoE/XYpK/QoOg=="}]},"_npmUser":{"name":"100xdevs","email":"100xdevs@gmail.com"},"directories":{},"maintainers":[{"name":"100xdevs","email":"100xdevs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/assignment-1_1.0.0_1690715031565_0.344168060550184"},"_hasShrinkwrap":false},"1.0.1":{"name":"@100xdevs/assignment-1","version":"1.0.1","description":"Convert this from JS to typescript.","main":"index.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC","dependencies":{"@types/cors":"^2.8.13","@types/express":"^4.17.17","@types/jsonwebtoken":"^9.0.2","@types/mongoose":"^5.11.97","cors":"^2.8.5","express":"^4.18.2","jsonwebtoken":"^9.0.1","mongoose":"^7.4.1","zod":"^3.21.4"},"gitHead":"9be90d05e818a4196e12506b0a211f1e943719f2","_id":"@100xdevs/assignment-1@1.0.1","_nodeVersion":"18.1.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-c77z4w+pj5VlltnhbC5PePS6Ob/1BPDdxZonqakcQLAvBEbCRBBYB0uVStBQd+oKWOBtuYVt1tuhxjdRr5va6w==","shasum":"e21ae7d85303b5f9ab2166c6ae1e2bc181a2fac2","tarball":"https://registry.npmjs.org/@100xdevs/assignment-1/-/assignment-1-1.0.1.tgz","fileCount":9,"unpackedSize":12359,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC6QnFe1hIoRccK2zQaC8Aumutgt+TJCqCg24x4SC0yZgIhAIAXDfpH4O7TiUvuguzyrFRhJYMIhvxE0dBSHvPOPkHh"}]},"_npmUser":{"name":"100xdevs","email":"100xdevs@gmail.com"},"directories":{},"maintainers":[{"name":"100xdevs","email":"100xdevs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/assignment-1_1.0.1_1690715268205_0.5972392929387591"},"_hasShrinkwrap":false},"1.0.2":{"name":"@100xdevs/assignment-1","version":"1.0.2","description":"Convert this from JS to typescript.","main":"dist/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC","dependencies":{"@types/cors":"^2.8.13","@types/express":"^4.17.17","@types/jsonwebtoken":"^9.0.2","@types/mongoose":"^5.11.97","cors":"^2.8.5","express":"^4.18.2","jsonwebtoken":"^9.0.1","mongoose":"^7.4.1","zod":"^3.21.4"},"gitHead":"9be90d05e818a4196e12506b0a211f1e943719f2","_id":"@100xdevs/assignment-1@1.0.2","_nodeVersion":"18.1.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-c0+5jWNkYuDl1zKKVe/nTUyhDeo299DHIRInBB6lxba9Zn8D1rM9C6D755AKiVEfUvI+GH0yV0NiAMDLr2orUw==","shasum":"f59122fc0d00a71d19eec299b92638f74cad6f3f","tarball":"https://registry.npmjs.org/@100xdevs/assignment-1/-/assignment-1-1.0.2.tgz","fileCount":14,"unpackedSize":19728,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFUqyA0JErd3ZpvSz8on8WfWN2o3dy0klb+JAFwRXCQ8AiAYtwT+oeIQ7Sxc4lVCSH+Hu8Sxegqpp7bMrvtK8loV3Q=="}]},"_npmUser":{"name":"100xdevs","email":"100xdevs@gmail.com"},"directories":{},"maintainers":[{"name":"100xdevs","email":"100xdevs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/assignment-1_1.0.2_1690715374129_0.20856816582773208"},"_hasShrinkwrap":false},"1.0.4":{"name":"@100xdevs/assignment-1","version":"1.0.4","description":"Convert this from JS to typescript.","main":"dist/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC","dependencies":{"@types/cors":"^2.8.13","@types/express":"^4.17.17","@types/jsonwebtoken":"^9.0.2","@types/mongoose":"^5.11.97","cors":"^2.8.5","express":"^4.18.2","jsonwebtoken":"^9.0.1","mongoose":"^7.4.1","zod":"^3.21.4"},"gitHead":"9be90d05e818a4196e12506b0a211f1e943719f2","_id":"@100xdevs/assignment-1@1.0.4","_nodeVersion":"18.1.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-42mIoLkDLuNSYvgsGLwM1SIfr+dvdrDCJc0wcaEOeQqnOpBxKcVR2GbNjMPa8Q7eTBVJ0Ntc2mHqXGICR44jKg==","shasum":"5cc6309b73181feb1cdbc371f334dda247b837b9","tarball":"https://registry.npmjs.org/@100xdevs/assignment-1/-/assignment-1-1.0.4.tgz","fileCount":3,"unpackedSize":4056,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjtpRwJBKmcbDzZghHNzDfhBDY4XhmgVvErwmqzVph7QIgJ3zN6tWlb9LUj5UlVOqCGPTEBiF/QmM7JXmB9PmNWxc="}]},"_npmUser":{"name":"100xdevs","email":"100xdevs@gmail.com"},"directories":{},"maintainers":[{"name":"100xdevs","email":"100xdevs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/assignment-1_1.0.4_1690715911031_0.8274397671827194"},"_hasShrinkwrap":false},"1.0.5":{"name":"@100xdevs/assignment-1","version":"1.0.5","description":"Convert this from JS to typescript.","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC","dependencies":{"@types/cors":"^2.8.13","@types/express":"^4.17.17","@types/jsonwebtoken":"^9.0.2","@types/mongoose":"^5.11.97","cors":"^2.8.5","express":"^4.18.2","jsonwebtoken":"^9.0.1","mongoose":"^7.4.1","zod":"^3.21.4"},"gitHead":"9be90d05e818a4196e12506b0a211f1e943719f2","_id":"@100xdevs/assignment-1@1.0.5","_nodeVersion":"18.1.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-9IRUGKWyCRkcn1jjCvjipDD7qTMt0rQF7EWgy+MsIBGZwUU++MqDK5dXzmknf42eAq6GuhOXFgija43tooMMfg==","shasum":"21339b4c9824b5d18f3665028b06d30351ababea","tarball":"https://registry.npmjs.org/@100xdevs/assignment-1/-/assignment-1-1.0.5.tgz","fileCount":3,"unpackedSize":4086,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFqZFQ04LUlWaR/uZdcKI+bE4/+nRYzaNwErSoE619bKAiEAigT6OgSL/6llZb8Md263MYll7MjRtLXsOnOCUPIBVdE="}]},"_npmUser":{"name":"100xdevs","email":"100xdevs@gmail.com"},"directories":{},"maintainers":[{"name":"100xdevs","email":"100xdevs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/assignment-1_1.0.5_1690716351531_0.2402010991649286"},"_hasShrinkwrap":false},"1.0.6":{"name":"@100xdevs/assignment-1","version":"1.0.6","description":"Convert this from JS to typescript.","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC","dependencies":{"@types/cors":"^2.8.13","@types/express":"^4.17.17","@types/jsonwebtoken":"^9.0.2","@types/mongoose":"^5.11.97","cors":"^2.8.5","express":"^4.18.2","jsonwebtoken":"^9.0.1","mongoose":"^7.4.1","zod":"^3.21.4"},"gitHead":"9be90d05e818a4196e12506b0a211f1e943719f2","_id":"@100xdevs/assignment-1@1.0.6","_nodeVersion":"18.1.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-75lh8gqkLvdp6hsz8cALgNXmdNL5JwhJz68ecTzDTKEuz+oV3iVV9Q1EGtti8SZVg7yEjuIWxFVqLHxx+SUhtw==","shasum":"459a921f2403b2dddfe34990ec6029faa5525f81","tarball":"https://registry.npmjs.org/@100xdevs/assignment-1/-/assignment-1-1.0.6.tgz","fileCount":3,"unpackedSize":4086,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD9X5np4vLuuj4xRKFsvBi8qDdOTd5HpbMeiPnlSRmu0gIhAMPPjKsK1dNuKYNTaT8xZ55nYVHQHZ64XOcD8JC9qBOL"}]},"_npmUser":{"name":"100xdevs","email":"100xdevs@gmail.com"},"directories":{},"maintainers":[{"name":"100xdevs","email":"100xdevs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/assignment-1_1.0.6_1690716418453_0.16961958499513252"},"_hasShrinkwrap":false},"1.0.7":{"name":"@100xdevs/assignment-1","version":"1.0.7","description":"Convert this from JS to typescript.","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC","dependencies":{"@types/cors":"^2.8.13","@types/express":"^4.17.17","@types/jsonwebtoken":"^9.0.2","@types/mongoose":"^5.11.97","cors":"^2.8.5","express":"^4.18.2","jsonwebtoken":"^9.0.1","mongoose":"^7.4.1","zod":"^3.21.4"},"gitHead":"9be90d05e818a4196e12506b0a211f1e943719f2","_id":"@100xdevs/assignment-1@1.0.7","_nodeVersion":"18.1.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-z0jL7Me/7QrOSu5wseQa55oXf6clvPcwZvYAcMYlUvVrLh/ZkUJGf9cs8vrREP89hdL5z6PUKV6OMajudFvzWA==","shasum":"69c379a299dace5516f489362b6adf4995d97578","tarball":"https://registry.npmjs.org/@100xdevs/assignment-1/-/assignment-1-1.0.7.tgz","fileCount":15,"unpackedSize":24987,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCypkGSiwyI8qT1MaG8T63tfAOJMeZin4b2Dmg+Jp8SdgIgWTk2AI393+z/ZzY1i7RqyQ9qAxnGSITEFhd39WzB7AY="}]},"_npmUser":{"name":"100xdevs","email":"100xdevs@gmail.com"},"directories":{},"maintainers":[{"name":"100xdevs","email":"100xdevs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/assignment-1_1.0.7_1690716785518_0.4838007039267491"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-30T11:03:51.503Z","1.0.0":"2023-07-30T11:03:51.750Z","modified":"2023-07-30T11:33:05.764Z","1.0.1":"2023-07-30T11:07:48.387Z","1.0.2":"2023-07-30T11:09:34.279Z","1.0.4":"2023-07-30T11:18:31.164Z","1.0.5":"2023-07-30T11:25:51.655Z","1.0.6":"2023-07-30T11:26:58.584Z","1.0.7":"2023-07-30T11:33:05.647Z"},"maintainers":[{"name":"100xdevs","email":"100xdevs@gmail.com"}],"description":"Convert this from JS to typescript.","keywords":[],"license":"ISC","readme":"### This project contains the backend for a simple todo app\nConvert this from JS to typescript.\nWe have a simple backend for a TODO application.\nFirst, just go through the codebase and make sure you understand it. There is a postman collection for you to try this out locally\nRun node index.js to run the app locally and try all the routes in postman.\nYou WILL need mongoDB running locally, or a cloud mongoDB instance. Please replace the mongoDB url in index.js with your own mongoDB url.\n\n### Steps to follow\n - First step in doing this is to convert the JS files to TS files (replacing the extension of all files).\n - Next, run `tsc --init` to create a tsconfig.json file (make sure u already have tsc (npm i -g tsc)).\n - Set strict to false for now until we add all types.\n - Set outDir to dist so as to not pollute your original folder\n - Try running it, notice the errors that you see.\n   - The errors you will see should be of the format \n   - 'mongoose' was also declared here.\n   - Move all requires => imports to fix these errors. This is related to a bug bug in TS (https://stackoverflow.com/questions/35758584/cannot-redeclare-block-scoped-variable)\n   - For example, convert\n     - `const mongoose = require('mongoose');` to\n     - `import mongoose from 'mongoose';`\n   - Same thing for exports, export using the modern ES6 syntax\n     - `module.exports = mongoose.model('Todo', todoSchema);` to\n     - `export default mongoose.model('Todo', todoSchema);`\n - Now typescript shouldnt complain, but this isn't the end. We still have to flip on strict to actually see errors.\n - Check out the errors that you see\n - Next, run `npm install -D @types/node` to install the types for node.\n - Next, run `npm install -D @types/express` to install the types for express.\n - Next, run `npm install -D @types/mongoose` to install the types for mongoose.\n - You will see a bunch of `Parameter 'req' implicitly has an 'any' type.` errors. Fix these by adding types to all the functions.\n   - Express exports the Request and Response types, use them to type the req and res params.\n   - If you ever get stuck, initially you can use the any type\n   - You can also just flip noImplicitAny to false in tsconfig, but that's cheating.\n - You will see req.userId complains everywhere, and rightfully so. We've added userId key to an object that doesn't expect it. Fix this by sending over the id via the headers.\n - Create types for the inputs to all routes (for eg User, Todo) and use them when u decode the body.\n - Try running tsc now, you should see no errors. \n","readmeFilename":"README.md"}