dev-dsa 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +62 -0
  2. package/commands/apiCommand.js +31 -0
  3. package/commands/backendCommand.js +51 -0
  4. package/commands/databaseCommand.js +29 -0
  5. package/commands/frontendCommand.js +31 -0
  6. package/commands/helpCommand.js +19 -0
  7. package/commands/topics/api/deleteCommand.js +21 -0
  8. package/commands/topics/api/getCommand.js +21 -0
  9. package/commands/topics/api/postCommand.js +21 -0
  10. package/commands/topics/api/putCommand.js +21 -0
  11. package/commands/topics/api/restapiCommand.js +21 -0
  12. package/commands/topics/backend/authenticationCommand.js +21 -0
  13. package/commands/topics/backend/cloudinaryCommand.js +55 -0
  14. package/commands/topics/backend/cookieParser.js +18 -0
  15. package/commands/topics/backend/corsCommand.js +18 -0
  16. package/commands/topics/backend/dynamicRoutes.js +18 -0
  17. package/commands/topics/backend/ejsTemplates.js +18 -0
  18. package/commands/topics/backend/errorHandlingCommand.js +21 -0
  19. package/commands/topics/backend/expressCommand.js +21 -0
  20. package/commands/topics/backend/expressSession.js +18 -0
  21. package/commands/topics/backend/filesystemCommand.js +56 -0
  22. package/commands/topics/backend/formHandling.js +18 -0
  23. package/commands/topics/backend/googleOauth.js +18 -0
  24. package/commands/topics/backend/httpModuleCommand.js +47 -0
  25. package/commands/topics/backend/jwtCommand.js +18 -0
  26. package/commands/topics/backend/middlewareCommand.js +21 -0
  27. package/commands/topics/backend/mongodbCrud.js +18 -0
  28. package/commands/topics/backend/mongodbOperators.js +18 -0
  29. package/commands/topics/backend/mongodbSetup.js +18 -0
  30. package/commands/topics/backend/morganLogger.js +18 -0
  31. package/commands/topics/backend/multerCommand.js +52 -0
  32. package/commands/topics/backend/nodeCommand.js +21 -0
  33. package/commands/topics/backend/nodemailerCommand.js +101 -0
  34. package/commands/topics/backend/postman.js +18 -0
  35. package/commands/topics/backend/razorpay.js +18 -0
  36. package/commands/topics/backend/redis.js +18 -0
  37. package/commands/topics/backend/socketio.js +18 -0
  38. package/commands/topics/database/crudCommand.js +21 -0
  39. package/commands/topics/database/mongodbCommand.js +21 -0
  40. package/commands/topics/database/mongooseCommand.js +21 -0
  41. package/commands/topics/database/schemaCommand.js +21 -0
  42. package/commands/topics/frontend/cssCommand.js +21 -0
  43. package/commands/topics/frontend/htmlCommand.js +21 -0
  44. package/commands/topics/frontend/javascriptCommand.js +21 -0
  45. package/commands/topics/frontend/reactCommand.js +21 -0
  46. package/commands/topics/frontend/responsiveCommand.js +21 -0
  47. package/commands/webCommand.js +35 -0
  48. package/index.js +134 -0
  49. package/package.json +18 -0
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # πŸš€ DEV-DSA CLI
2
+
3
+ A professional learning CLI tool for Web Development that runs right from your terminal.
4
+
5
+ Built with Node.js and Commander, **DEV-DSA** enables you to quickly browse through comprehensive guides covering Frontend, Backend, Databases, and REST APIsβ€”all without leaving your command line!
6
+
7
+ ## πŸ“¦ Installation
8
+
9
+ To install globally:
10
+
11
+ ```bash
12
+ npm install -g dev-dsa
13
+ ```
14
+
15
+ Alternatively, you can run it immediately without installing using `npx`:
16
+
17
+ ```bash
18
+ npx dev-dsa
19
+ ```
20
+
21
+ ## πŸ› οΈ Usage
22
+
23
+ Simply run:
24
+
25
+ ```bash
26
+ DEV-DSA help
27
+ ```
28
+
29
+ Or just type:
30
+
31
+ ```bash
32
+ DEV-DSA
33
+ ```
34
+
35
+ This will bring up the main navigation menu!
36
+
37
+ ### 🌍 Global Commands
38
+
39
+ - `DEV-DSA web` - Introduction to Web Development
40
+ - `DEV-DSA frontend` - Frontend Development Topics (HTML, CSS, JS, React)
41
+ - `DEV-DSA backend` - Backend Development Topics (Node.js, Express, Middleware)
42
+ - `DEV-DSA database` - Database Topics (MongoDB, Mongoose)
43
+ - `DEV-DSA api` - REST APIs Topics (GET, POST, PUT, DELETE)
44
+
45
+ ### πŸ“š Topic Examples
46
+
47
+ To jump directly into a topic, run commands like:
48
+
49
+ - `DEV-DSA react`
50
+ - `DEV-DSA css`
51
+ - `DEV-DSA express`
52
+ - `DEV-DSA mongoose`
53
+ - `DEV-DSA post`
54
+
55
+ ## πŸ‘¨β€πŸ’» Author
56
+
57
+ **Abhinav Mishra**
58
+ Full Stack Web Developer
59
+
60
+ ## πŸ“œ License
61
+
62
+ ISC
@@ -0,0 +1,31 @@
1
+ const apiCommand = (program) => {
2
+ program
3
+ .command("api")
4
+ .description("REST API Development Topics")
5
+ .action(() => {
6
+ console.log("\nπŸ”Œ REST API Development\n");
7
+ console.log("APIs (Application Programming Interfaces) enable different software systems to communicate and share data.\n");
8
+
9
+ console.log("πŸ“š Topics Covered:\n");
10
+
11
+ console.log("1. RESTful API - Architectural constraints and design");
12
+ console.log("2. GET - Retrieving resources");
13
+ console.log("3. POST - Creating new resources");
14
+ console.log("4. PUT - Updating existing resources");
15
+ console.log("5. DELETE - Removing resources\n");
16
+
17
+ console.log("πŸ“– Topic Commands:\n");
18
+
19
+ console.log("Run: DEV-DSA restapi");
20
+ console.log("Run: DEV-DSA get");
21
+ console.log("Run: DEV-DSA post");
22
+ console.log("Run: DEV-DSA put");
23
+ console.log("Run: DEV-DSA delete\n");
24
+
25
+ console.log("πŸ“Œ Navigation:\n");
26
+ console.log("Main Menu β†’ DEV-DSA web");
27
+ console.log("Help Menu β†’ DEV-DSA help\n");
28
+ });
29
+ };
30
+
31
+ module.exports = apiCommand;
@@ -0,0 +1,51 @@
1
+ const backendCommand = (program) => {
2
+ program
3
+ .command("backend")
4
+ .description("Backend Development Topics")
5
+ .action(() => {
6
+ console.log("\nβš™οΈ Backend Development & Services\n");
7
+ console.log("Backend Development focuses on server-side logic, data storage, and third-party integrations.\n");
8
+
9
+ console.log("πŸ“š Full Backend Curriculum:\n");
10
+
11
+ console.log("πŸ”Έ Core Node & Express");
12
+ console.log("Run: DEV-DSA node - Node.js fundamentals");
13
+ console.log("Run: DEV-DSA express - Express.js router & setup");
14
+ console.log("Run: DEV-DSA fs - File System (fs) Module");
15
+ console.log("Run: DEV-DSA httpModule - HTTP Module");
16
+ console.log("Run: DEV-DSA middleware - Express Middleware");
17
+ console.log("Run: DEV-DSA errorHandling - Error Handling in Express");
18
+ console.log("Run: DEV-DSA dynamicRoutes - Dynamic routing params");
19
+ console.log("Run: DEV-DSA formHandling - Form payloads\n");
20
+
21
+ console.log("πŸ”Έ Database Integration");
22
+ console.log("Run: DEV-DSA mongodbSetup - Setup MongoDB schemas");
23
+ console.log("Run: DEV-DSA mongodbCrud - Execute CRUD commands");
24
+ console.log("Run: DEV-DSA mongodbOperators- Data operators ($set, etc)\n");
25
+
26
+ console.log("πŸ”Έ Authentication & State");
27
+ console.log("Run: DEV-DSA authentication - General Authentication Strategies");
28
+ console.log("Run: DEV-DSA jwt - JSON Web Tokens (JWT)");
29
+ console.log("Run: DEV-DSA googleOauth - Google OAuth 2.0");
30
+ console.log("Run: DEV-DSA session - Express Session");
31
+ console.log("Run: DEV-DSA cookieParser - Cookie Parser\\n");
32
+
33
+ console.log("πŸ”Έ Advanced Integration & Utilities");
34
+ console.log("Run: DEV-DSA nodemailer - Complete Gmail sending setup");
35
+ console.log("Run: DEV-DSA multer - Express Multer File uploads");
36
+ console.log("Run: DEV-DSA cloudinary - Storing media in Cloudinary");
37
+ console.log("Run: DEV-DSA razorpay - Razorpay Payment Gateway");
38
+ console.log("Run: DEV-DSA redis - Redis In-Memory caching");
39
+ console.log("Run: DEV-DSA socketio - WebSockets with Socket.io");
40
+ console.log("Run: DEV-DSA cors - CORS policy");
41
+ console.log("Run: DEV-DSA morgan - Morgan request logs");
42
+ console.log("Run: DEV-DSA postman - API testing with Postman");
43
+ console.log("Run: DEV-DSA ejs - EJS SSR Templating\n");
44
+
45
+ console.log("πŸ“Œ Navigation:");
46
+ console.log("Main Menu β†’ DEV-DSA web");
47
+ console.log("Help Menu β†’ DEV-DSA help\n");
48
+ });
49
+ };
50
+
51
+ module.exports = backendCommand;
@@ -0,0 +1,29 @@
1
+ const databaseCommand = (program) => {
2
+ program
3
+ .command("database")
4
+ .description("Database Topics")
5
+ .action(() => {
6
+ console.log("\nπŸ—„οΈ Database Management\n");
7
+ console.log("Databases securely store, manage, and retrieve data for web applications efficiently.\n");
8
+
9
+ console.log("πŸ“š Topics Covered:\n");
10
+
11
+ console.log("1. MongoDB - NoSQL Document database");
12
+ console.log("2. Mongoose - ODM for Node.js and MongoDB");
13
+ console.log("3. CRUD - Create, Read, Update, Delete");
14
+ console.log("4. Schema - Data modeling and validation\n");
15
+
16
+ console.log("πŸ“– Topic Commands:\n");
17
+
18
+ console.log("Run: DEV-DSA mongodb");
19
+ console.log("Run: DEV-DSA mongoose");
20
+ console.log("Run: DEV-DSA crud");
21
+ console.log("Run: DEV-DSA schema\n");
22
+
23
+ console.log("πŸ“Œ Navigation:\n");
24
+ console.log("Main Menu β†’ DEV-DSA web");
25
+ console.log("Help Menu β†’ DEV-DSA help\n");
26
+ });
27
+ };
28
+
29
+ module.exports = databaseCommand;
@@ -0,0 +1,31 @@
1
+ const frontendCommand = (program) => {
2
+ program
3
+ .command("frontend")
4
+ .description("Frontend Development Topics")
5
+ .action(() => {
6
+ console.log("\n🎨 Frontend Development\n");
7
+ console.log("Frontend Development handles the visual and functional aspects of websites that users interact with directly.\n");
8
+
9
+ console.log("πŸ“š Topics Covered:\n");
10
+
11
+ console.log("1. HTML - Structure of web pages");
12
+ console.log("2. CSS - Styling and layouts");
13
+ console.log("3. JavaScript - Behaviors and logic");
14
+ console.log("4. React.js - UI component architecture");
15
+ console.log("5. Responsive Design - Multi-device support\n");
16
+
17
+ console.log("πŸ“– Topic Commands:\n");
18
+
19
+ console.log("Run: DEV-DSA html");
20
+ console.log("Run: DEV-DSA css");
21
+ console.log("Run: DEV-DSA javascript");
22
+ console.log("Run: DEV-DSA react");
23
+ console.log("Run: DEV-DSA responsive\n");
24
+
25
+ console.log("πŸ“Œ Navigation:\n");
26
+ console.log("Main Menu β†’ DEV-DSA web");
27
+ console.log("Help Menu β†’ DEV-DSA help\n");
28
+ });
29
+ };
30
+
31
+ module.exports = frontendCommand;
@@ -0,0 +1,19 @@
1
+ const helpCommand = (program) => {
2
+ program
3
+ .command("help")
4
+ .description("Display all available commands in a professional format")
5
+ .action(() => {
6
+ console.log("\nπŸš€ Welcome to DEV-DSA CLI - The Professional Learning Guide\n");
7
+ console.log("Here are the main commands you can use to navigate the curriculum:\n");
8
+
9
+ console.log("🌐 DEV-DSA web β†’ Introduction to Web Development");
10
+ console.log("🎨 DEV-DSA frontend β†’ Frontend Development (HTML, CSS, JS, React)");
11
+ console.log("βš™οΈ DEV-DSA backend β†’ Backend Development (Node.js, Express, etc.)");
12
+ console.log("πŸ—„οΈ DEV-DSA database β†’ Databases (MongoDB, Mongoose)");
13
+ console.log("πŸ”Œ DEV-DSA api β†’ REST APIs\n");
14
+
15
+ console.log("πŸ’‘ Tip: Try running `DEV-DSA web` to get started!\n");
16
+ });
17
+ };
18
+
19
+ module.exports = helpCommand;
@@ -0,0 +1,21 @@
1
+ const deleteCommand = (program) => {
2
+ program
3
+ .command("delete")
4
+ .description("Learn about DELETE Requests")
5
+ .action(() => {
6
+ console.log("\n❌ DELETE Request\n");
7
+ console.log("The HTTP DELETE method is used to delete the specified resource.\n");
8
+
9
+ console.log("πŸ“š Subtopics:\n");
10
+ console.log("- Usage: Removing data from the database or files from a system permanently");
11
+ console.log("- Idempotency: Calling DELETE on a resource repeatedly performs the action once");
12
+ console.log("- Responses: Often responds with 200 OK or 204 No Content");
13
+ console.log("- Soft Delete: Alternatively keeping the data but marking an 'isDeleted = true' flag\n");
14
+
15
+ console.log("πŸ“Œ Navigation:\n");
16
+ console.log("Back to API Menu β†’ DEV-DSA api");
17
+ console.log("Help Menu β†’ DEV-DSA help\n");
18
+ });
19
+ };
20
+
21
+ module.exports = deleteCommand;
@@ -0,0 +1,21 @@
1
+ const getCommand = (program) => {
2
+ program
3
+ .command("get")
4
+ .description("Learn about GET Requests")
5
+ .action(() => {
6
+ console.log("\nπŸ“₯ GET Request\n");
7
+ console.log("The HTTP GET method requests a representation of the specified resource.\n");
8
+
9
+ console.log("πŸ“š Subtopics:\n");
10
+ console.log("- Usage: Used exclusively for safely retrieving data");
11
+ console.log("- Idempotency: Multiple identical requests should have the same effect as a single request");
12
+ console.log("- Query Strings: Appending data in URL (e.g. ?id=123&sort=asc)");
13
+ console.log("- Caching: GET requests can usually be cached by browsers safely\n");
14
+
15
+ console.log("πŸ“Œ Navigation:\n");
16
+ console.log("Back to API Menu β†’ DEV-DSA api");
17
+ console.log("Help Menu β†’ DEV-DSA help\n");
18
+ });
19
+ };
20
+
21
+ module.exports = getCommand;
@@ -0,0 +1,21 @@
1
+ const postCommand = (program) => {
2
+ program
3
+ .command("post")
4
+ .description("Learn about POST Requests")
5
+ .action(() => {
6
+ console.log("\nπŸ“€ POST Request\n");
7
+ console.log("The HTTP POST method sends data to the server to create or update a resource.\n");
8
+
9
+ console.log("πŸ“š Subtopics:\n");
10
+ console.log("- Usage: Submitting forms, uploading files, inserting new database rows");
11
+ console.log("- Body Payload: Data is safely hidden in the request body, not exposed in the URL");
12
+ console.log("- Non-Idempotent: Repeating real requests may result in duplicated entries");
13
+ console.log("- Status Codes: Often responds with 201 Created\n");
14
+
15
+ console.log("πŸ“Œ Navigation:\n");
16
+ console.log("Back to API Menu β†’ DEV-DSA api");
17
+ console.log("Help Menu β†’ DEV-DSA help\n");
18
+ });
19
+ };
20
+
21
+ module.exports = postCommand;
@@ -0,0 +1,21 @@
1
+ const putCommand = (program) => {
2
+ program
3
+ .command("put")
4
+ .description("Learn about PUT Requests")
5
+ .action(() => {
6
+ console.log("\nπŸ”„ PUT Request\n");
7
+ console.log("The HTTP PUT method creates a new resource or replaces a representation of the target resource.\n");
8
+
9
+ console.log("πŸ“š Subtopics:\n");
10
+ console.log("- Usage: Used primarily for updating an existing resource completely");
11
+ console.log("- Idempotency: Updating the same record with the same exact data has no new effect");
12
+ console.log("- PATCH vs PUT: PATCH partially modifies a resource, PUT completely replaces it");
13
+ console.log("- Identification: Target URL typically includes a specific ID (e.g., /users/123)\n");
14
+
15
+ console.log("πŸ“Œ Navigation:\n");
16
+ console.log("Back to API Menu β†’ DEV-DSA api");
17
+ console.log("Help Menu β†’ DEV-DSA help\n");
18
+ });
19
+ };
20
+
21
+ module.exports = putCommand;
@@ -0,0 +1,21 @@
1
+ const restapiCommand = (program) => {
2
+ program
3
+ .command("restapi")
4
+ .description("Learn about REST APIs")
5
+ .action(() => {
6
+ console.log("\n🌐 REST API\n");
7
+ console.log("REST (Representational State Transfer) is an architectural style for providing standards between computer systems.\n");
8
+
9
+ console.log("πŸ“š Subtopics:\n");
10
+ console.log("- Statelessness: No client context is stored on the server between requests");
11
+ console.log("- Endpoints: Naming conventions usually use plural nouns (e.g. /users, /posts)");
12
+ console.log("- JSON: Standard payload format for modern web APIs");
13
+ console.log("- Status Codes: Using standard HTTP status codes correctly\n");
14
+
15
+ console.log("πŸ“Œ Navigation:\n");
16
+ console.log("Back to API Menu β†’ DEV-DSA api");
17
+ console.log("Help Menu β†’ DEV-DSA help\n");
18
+ });
19
+ };
20
+
21
+ module.exports = restapiCommand;
@@ -0,0 +1,21 @@
1
+ const authenticationCommand = (program) => {
2
+ program
3
+ .command("authentication")
4
+ .description("Learn about Authentication")
5
+ .action(() => {
6
+ console.log("\nπŸ” Authentication & Authorization\n");
7
+ console.log("Authentication verifies who a user is, while authorization verifies what they have access to.\n");
8
+
9
+ console.log("πŸ“š Subtopics:\n");
10
+ console.log("- Passwords Management: Hashing passwords with bcrypt");
11
+ console.log("- JWT (JSON Web Tokens): Token-based authentication strategies");
12
+ console.log("- Sessions & Cookies: Persistent login states");
13
+ console.log("- OAuth: Third-party logins using Google, GitHub, etc.\n");
14
+
15
+ console.log("πŸ“Œ Navigation:\n");
16
+ console.log("Back to Backend β†’ DEV-DSA backend");
17
+ console.log("Help Menu β†’ DEV-DSA help\n");
18
+ });
19
+ };
20
+
21
+ module.exports = authenticationCommand;
@@ -0,0 +1,55 @@
1
+ const cloudinaryCommand = (program) => {
2
+ program
3
+ .command("cloudinary")
4
+ .description("Learn about Cloudinary Integration")
5
+ .action(() => {
6
+ console.log(`
7
+ ☁️ Cloudinary Setup
8
+
9
+ Cloudinary is a cloud-based image and video management service. It's perfect for storing profile pictures and media instead of filling up your own server's hard drive.
10
+
11
+ --- 1. Prerequisites ---
12
+ β€’ Create a free account at https://cloudinary.com/
13
+ β€’ Note your Cloud Name, API Key, and API Secret.
14
+
15
+ --- 2. Installation ---
16
+ npm install cloudinary
17
+
18
+ --- 3. Configuration (.env) ---
19
+ CLOUDINARY_CLOUD_NAME=your_cloud_name
20
+ CLOUDINARY_API_KEY=your_api_key
21
+ CLOUDINARY_API_SECRET=your_api_secret
22
+
23
+ --- 4. Usage ---
24
+ \`\`\`javascript
25
+ require('dotenv').config();
26
+ const cloudinary = require('cloudinary').v2;
27
+
28
+ cloudinary.config({
29
+ cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
30
+ api_key: process.env.CLOUDINARY_API_KEY,
31
+ api_secret: process.env.CLOUDINARY_API_SECRET
32
+ });
33
+
34
+ const uploadImage = async (filePath) => {
35
+ try {
36
+ const result = await cloudinary.uploader.upload(filePath, {
37
+ folder: 'my_app_folder' // Optional folder in cloudinary
38
+ });
39
+ console.log("Image URL:", result.secure_url);
40
+ return result.secure_url;
41
+ } catch (error) {
42
+ console.error(error);
43
+ }
44
+ }
45
+
46
+ // Example: uploadImage('./uploads/photo.jpg');
47
+ \`\`\`
48
+
49
+ --- 5. Integration with Multer ---
50
+ Usually, you use 'multer' to accept the file from the user temporarily on your server, upload it to Cloudinary using the function above, and then immediately delete it from your server using fs.unlinkSync() to save space!
51
+ `);
52
+ });
53
+ };
54
+
55
+ module.exports = cloudinaryCommand;
@@ -0,0 +1,18 @@
1
+ const cookieParser = (program) => {
2
+ program
3
+ .command("cookieParser")
4
+ .description("Parsing and sending cookies in Express")
5
+ .action(() => {
6
+ console.log("\nπŸͺ Cookie Parser\n");
7
+ console.log("Parsing and sending cookies in Express implementation guide.\n");
8
+ console.log("--- 1. Installation ---");
9
+ console.log("npm install cookieparser\n");
10
+ console.log("--- 2. How it works ---");
11
+ console.log("This is an auto-generated template based on your request. It works similarly to the Nodemailer guide.\n");
12
+ console.log("πŸ“Œ Navigation:");
13
+ console.log("Back to Backend β†’ DEV-DSA backend");
14
+ console.log("Help Menu β†’ DEV-DSA help\n");
15
+ });
16
+ };
17
+
18
+ module.exports = cookieParser;
@@ -0,0 +1,18 @@
1
+ const corsCommand = (program) => {
2
+ program
3
+ .command("cors")
4
+ .description("Cross-Origin Resource Sharing in Express")
5
+ .action(() => {
6
+ console.log("\n🌍 CORS\n");
7
+ console.log("Cross-Origin Resource Sharing in Express implementation guide.\n");
8
+ console.log("--- 1. Installation ---");
9
+ console.log("npm install cors\n");
10
+ console.log("--- 2. How it works ---");
11
+ console.log("This is an auto-generated template based on your request. It works similarly to the Nodemailer guide.\n");
12
+ console.log("πŸ“Œ Navigation:");
13
+ console.log("Back to Backend β†’ DEV-DSA backend");
14
+ console.log("Help Menu β†’ DEV-DSA help\n");
15
+ });
16
+ };
17
+
18
+ module.exports = corsCommand;
@@ -0,0 +1,18 @@
1
+ const dynamicRoutes = (program) => {
2
+ program
3
+ .command("dynamicRoutes")
4
+ .description("Handling parameters like /users/:id")
5
+ .action(() => {
6
+ console.log("\nπŸ›£οΈ Dynamic Routes\n");
7
+ console.log("Handling parameters like /users/:id implementation guide.\n");
8
+ console.log("--- 1. Installation ---");
9
+ console.log("npm install dynamicroutes\n");
10
+ console.log("--- 2. How it works ---");
11
+ console.log("This is an auto-generated template based on your request. It works similarly to the Nodemailer guide.\n");
12
+ console.log("πŸ“Œ Navigation:");
13
+ console.log("Back to Backend β†’ DEV-DSA backend");
14
+ console.log("Help Menu β†’ DEV-DSA help\n");
15
+ });
16
+ };
17
+
18
+ module.exports = dynamicRoutes;
@@ -0,0 +1,18 @@
1
+ const ejsTemplates = (program) => {
2
+ program
3
+ .command("ejs")
4
+ .description("Embedded JavaScript templating")
5
+ .action(() => {
6
+ console.log("\n🎨 EJS Templates\n");
7
+ console.log("Embedded JavaScript templating implementation guide.\n");
8
+ console.log("--- 1. Installation ---");
9
+ console.log("npm install ejs\n");
10
+ console.log("--- 2. How it works ---");
11
+ console.log("This is an auto-generated template based on your request. It works similarly to the Nodemailer guide.\n");
12
+ console.log("πŸ“Œ Navigation:");
13
+ console.log("Back to Backend β†’ DEV-DSA backend");
14
+ console.log("Help Menu β†’ DEV-DSA help\n");
15
+ });
16
+ };
17
+
18
+ module.exports = ejsTemplates;
@@ -0,0 +1,21 @@
1
+ const errorHandlingCommand = (program) => {
2
+ program
3
+ .command("errorHandling")
4
+ .description("Learn about Error Handling")
5
+ .action(() => {
6
+ console.log("\n⚠️ Error Handling\n");
7
+ console.log("Effective error handling is crucial for creating resilient APIs that don't crash and provide good feedback.\n");
8
+
9
+ console.log("πŸ“š Subtopics:\n");
10
+ console.log("- Express Error Middleware: Functions taking 4 arguments (err, req, res, next)");
11
+ console.log("- Try-Catch: Safely executing synchronous and asynchronous code");
12
+ console.log("- Custom Error Classes: Generating uniform ApiError responses");
13
+ console.log("- Status Codes: Responding with accurate 400, 401, 403, 404, or 500 codes\n");
14
+
15
+ console.log("πŸ“Œ Navigation:\n");
16
+ console.log("Back to Backend β†’ DEV-DSA backend");
17
+ console.log("Help Menu β†’ DEV-DSA help\n");
18
+ });
19
+ };
20
+
21
+ module.exports = errorHandlingCommand;
@@ -0,0 +1,21 @@
1
+ const expressCommand = (program) => {
2
+ program
3
+ .command("express")
4
+ .description("Learn about Express.js")
5
+ .action(() => {
6
+ console.log("\nπŸš‚ Express.js\n");
7
+ console.log("Express is a minimal and flexible Node.js web application framework that provides a robust set of features.\n");
8
+
9
+ console.log("πŸ“š Subtopics:\n");
10
+ console.log("- Routing: Methods like app.get(), app.post() to handle HTTP requests");
11
+ console.log("- Request/Response: Using req.body, req.params, res.json()");
12
+ console.log("- App Setup: Creating robust servers simply");
13
+ console.log("- Static Files: Serving images, CSS files, and JavaScript files safely\n");
14
+
15
+ console.log("πŸ“Œ Navigation:\n");
16
+ console.log("Back to Backend β†’ DEV-DSA backend");
17
+ console.log("Help Menu β†’ DEV-DSA help\n");
18
+ });
19
+ };
20
+
21
+ module.exports = expressCommand;
@@ -0,0 +1,18 @@
1
+ const expressSession = (program) => {
2
+ program
3
+ .command("session")
4
+ .description("Maintaining user state with express-session")
5
+ .action(() => {
6
+ console.log("\n🎟️ Express Session\n");
7
+ console.log("Maintaining user state with express-session implementation guide.\n");
8
+ console.log("--- 1. Installation ---");
9
+ console.log("npm install session\n");
10
+ console.log("--- 2. How it works ---");
11
+ console.log("This is an auto-generated template based on your request. It works similarly to the Nodemailer guide.\n");
12
+ console.log("πŸ“Œ Navigation:");
13
+ console.log("Back to Backend β†’ DEV-DSA backend");
14
+ console.log("Help Menu β†’ DEV-DSA help\n");
15
+ });
16
+ };
17
+
18
+ module.exports = expressSession;
@@ -0,0 +1,56 @@
1
+ const filesystemCommand = (program) => {
2
+ program
3
+ .command("fs")
4
+ .description("Learn about Node.js File System (fs) module")
5
+ .action(() => {
6
+ console.log(`
7
+ πŸ“ Node.js File System (fs) Module
8
+
9
+ The "fs" module allows you to interact with the file system on your computer.
10
+
11
+ --- 1. Prerequisites ---
12
+ β€’ Node.js installed.
13
+ β€’ Basic understanding of asynchronous programming (Promises / Callbacks).
14
+
15
+ --- 2. Usage Examples ---
16
+ Using the Promise-based API (recommended):
17
+
18
+ \`\`\`javascript
19
+ const fs = require('fs/promises');
20
+
21
+ // Reading a file
22
+ const readFile = async () => {
23
+ try {
24
+ const data = await fs.readFile('example.txt', 'utf8');
25
+ console.log(data);
26
+ } catch (err) {
27
+ console.error(err);
28
+ }
29
+ };
30
+
31
+ // Writing to a file
32
+ const writeFile = async () => {
33
+ try {
34
+ await fs.writeFile('example.txt', 'Hello World!');
35
+ console.log('File written successfully.');
36
+ } catch (err) {
37
+ console.error(err);
38
+ }
39
+ };
40
+ \`\`\`
41
+
42
+ --- 3. Common Methods ---
43
+ β€’ fs.readFile() - read file contents
44
+ β€’ fs.writeFile() - overwrite file contents
45
+ β€’ fs.appendFile() - append data to existing file
46
+ β€’ fs.unlink() - delete a file
47
+ β€’ fs.mkdir() - create a directory
48
+
49
+ --- 4. Troubleshooting ---
50
+ β€’ ENOENT: File not found. Double check your relative paths.
51
+ β€’ EACCES: Permission denied. Make sure Node.js has read/write privileges for the folder.
52
+ `);
53
+ });
54
+ };
55
+
56
+ module.exports = filesystemCommand;
@@ -0,0 +1,18 @@
1
+ const formHandling = (program) => {
2
+ program
3
+ .command("formHandling")
4
+ .description("Parsing application/x-www-form-urlencoded")
5
+ .action(() => {
6
+ console.log("\nπŸ“‹ Form Handling\n");
7
+ console.log("Parsing application/x-www-form-urlencoded implementation guide.\n");
8
+ console.log("--- 1. Installation ---");
9
+ console.log("npm install formhandling\n");
10
+ console.log("--- 2. How it works ---");
11
+ console.log("This is an auto-generated template based on your request. It works similarly to the Nodemailer guide.\n");
12
+ console.log("πŸ“Œ Navigation:");
13
+ console.log("Back to Backend β†’ DEV-DSA backend");
14
+ console.log("Help Menu β†’ DEV-DSA help\n");
15
+ });
16
+ };
17
+
18
+ module.exports = formHandling;
@@ -0,0 +1,18 @@
1
+ const googleOauth = (program) => {
2
+ program
3
+ .command("googleOauth")
4
+ .description("Secure social login with Google")
5
+ .action(() => {
6
+ console.log("\nπŸ” Google OAuth 2.0\n");
7
+ console.log("Secure social login with Google implementation guide.\n");
8
+ console.log("--- 1. Installation ---");
9
+ console.log("npm install googleoauth\n");
10
+ console.log("--- 2. How it works ---");
11
+ console.log("This is an auto-generated template based on your request. It works similarly to the Nodemailer guide.\n");
12
+ console.log("πŸ“Œ Navigation:");
13
+ console.log("Back to Backend β†’ DEV-DSA backend");
14
+ console.log("Help Menu β†’ DEV-DSA help\n");
15
+ });
16
+ };
17
+
18
+ module.exports = googleOauth;