fsdcats 0.0.0-stage → 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.
- package/README.md +62 -2
- package/all-practicals.txt +905 -0
- package/bin/cli.js +81 -0
- package/index.js +10 -0
- package/lib/generator.js +97 -0
- package/lib/practicalsData.js +762 -0
- package/package.json +23 -4
- package/practical-1.txt +110 -0
- package/practical-2.txt +118 -0
- package/practical-3.txt +174 -0
- package/practical-4.txt +180 -0
- package/practical-5.txt +203 -0
- package/practical-crud.txt +84 -0
- package/practicals/crud-operations/server.js +55 -0
- package/practicals/p1-vue-directives/App.vue +59 -0
- package/practicals/p1-vue-directives/users.json +5 -0
- package/practicals/p2-props-emits/App.vue +53 -0
- package/practicals/p2-props-emits/DriverCard.vue +20 -0
- package/practicals/p3-file-upload/App.vue +67 -0
- package/practicals/p3-file-upload/server.js +61 -0
- package/practicals/p4-pinia-form/App.vue +54 -0
- package/practicals/p4-pinia-form/server.js +35 -0
- package/practicals/p4-pinia-form/store.js +39 -0
- package/practicals/p5-nuxt-routing/app.vue +6 -0
- package/practicals/p5-nuxt-routing/layouts/default.vue +21 -0
- package/practicals/p5-nuxt-routing/layouts/minimal.vue +9 -0
- package/practicals/p5-nuxt-routing/pages/about.vue +14 -0
- package/practicals/p5-nuxt-routing/pages/index.vue +8 -0
- package/practicals/p5-nuxt-routing/pages/items/[id].vue +32 -0
- package/practicals/p5-nuxt-routing/pages/items/index.vue +22 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const mongoose = require('mongoose');
|
|
3
|
+
const cors = require('cors');
|
|
4
|
+
|
|
5
|
+
const app = express();
|
|
6
|
+
app.use(cors());
|
|
7
|
+
app.use(express.json());
|
|
8
|
+
|
|
9
|
+
// MongoDB Application Schema
|
|
10
|
+
const Application = mongoose.model('Application', new mongoose.Schema({
|
|
11
|
+
personal: Object,
|
|
12
|
+
education: Object,
|
|
13
|
+
experience: Object,
|
|
14
|
+
createdAt: { type: Date, default: Date.now }
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
// POST /api/applications
|
|
18
|
+
app.post('/api/applications', async (req, res) => {
|
|
19
|
+
try {
|
|
20
|
+
const doc = await Application.create(req.body);
|
|
21
|
+
res.status(201).json(doc);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
res.status(400).json({ error: err.message });
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// GET /api/applications
|
|
28
|
+
app.get('/api/applications', async (req, res) => {
|
|
29
|
+
const docs = await Application.find().sort({ createdAt: -1 });
|
|
30
|
+
res.json(docs);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
mongoose.connect(process.env.MONGO_URI || 'mongodb://localhost:27017/job_app_db')
|
|
34
|
+
.then(() => app.listen(5000, () => console.log('Server running on port 5000')))
|
|
35
|
+
.catch(err => console.error(err));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
|
|
3
|
+
export const useApplicationStore = defineStore('application', {
|
|
4
|
+
state: () => ({
|
|
5
|
+
currentStep: 1,
|
|
6
|
+
personal: { name: '', email: '', phone: '' },
|
|
7
|
+
education: { degree: '', college: '', year: '' },
|
|
8
|
+
experience: { company: '', role: '' },
|
|
9
|
+
submitted: false
|
|
10
|
+
}),
|
|
11
|
+
actions: {
|
|
12
|
+
goNext() {
|
|
13
|
+
if (this.currentStep < 4) this.currentStep++
|
|
14
|
+
},
|
|
15
|
+
goBack() {
|
|
16
|
+
if (this.currentStep > 1) this.currentStep--
|
|
17
|
+
},
|
|
18
|
+
async submitApplication() {
|
|
19
|
+
const payload = {
|
|
20
|
+
personal: this.personal,
|
|
21
|
+
education: this.education,
|
|
22
|
+
experience: this.experience
|
|
23
|
+
}
|
|
24
|
+
const res = await fetch('http://localhost:5000/api/applications', {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: { 'Content-Type': 'application/json' },
|
|
27
|
+
body: JSON.stringify(payload)
|
|
28
|
+
})
|
|
29
|
+
if (res.ok) this.submitted = true
|
|
30
|
+
},
|
|
31
|
+
resetForm() {
|
|
32
|
+
this.currentStep = 1
|
|
33
|
+
this.personal = { name: '', email: '', phone: '' }
|
|
34
|
+
this.education = { degree: '', college: '', year: '' }
|
|
35
|
+
this.experience = { company: '', role: '' }
|
|
36
|
+
this.submitted = false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!-- app/layouts/default.vue: Shared Layout with persistent header & footer -->
|
|
2
|
+
<template>
|
|
3
|
+
<div style="font-family: sans-serif; padding: 20px;">
|
|
4
|
+
<header style="background: #f3f4f6; padding: 12px; margin-bottom: 20px;">
|
|
5
|
+
<nav>
|
|
6
|
+
<NuxtLink to="/" style="margin-right: 15px; font-weight: bold;">Home</NuxtLink>
|
|
7
|
+
<NuxtLink to="/items" style="margin-right: 15px; font-weight: bold;">Book Catalogue</NuxtLink>
|
|
8
|
+
<NuxtLink to="/about" style="font-weight: bold;">About</NuxtLink>
|
|
9
|
+
</nav>
|
|
10
|
+
</header>
|
|
11
|
+
|
|
12
|
+
<main>
|
|
13
|
+
<!-- Page content is automatically rendered inside this slot -->
|
|
14
|
+
<slot />
|
|
15
|
+
</main>
|
|
16
|
+
|
|
17
|
+
<footer style="margin-top: 40px; padding-top: 10px; border-top: 1px solid #ddd; color: #666;">
|
|
18
|
+
<p>© 2026 My Nuxt App</p>
|
|
19
|
+
</footer>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<!-- app/layouts/minimal.vue: Custom headerless layout -->
|
|
2
|
+
<template>
|
|
3
|
+
<div style="border: 2px dashed #ef4444; padding: 25px; text-align: center; font-family: sans-serif; max-width: 400px; margin: 30px auto;">
|
|
4
|
+
<h3>[Minimal Headerless Layout]</h3>
|
|
5
|
+
<slot />
|
|
6
|
+
<hr style="margin: 20px 0;" />
|
|
7
|
+
<NuxtLink to="/">← Return Home</NuxtLink>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!-- app/pages/about.vue: Route: /about (uses minimal layout) -->
|
|
2
|
+
<script setup>
|
|
3
|
+
// Switch this page to minimal layout instead of default
|
|
4
|
+
definePageMeta({
|
|
5
|
+
layout: 'minimal'
|
|
6
|
+
})
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div>
|
|
11
|
+
<h2>About Us</h2>
|
|
12
|
+
<p>This page uses <code>definePageMeta({ layout: 'minimal' })</code>.</p>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<!-- app/pages/index.vue: Root landing page (Route: /) -->
|
|
2
|
+
<template>
|
|
3
|
+
<div>
|
|
4
|
+
<h1>Welcome to Book Catalogue</h1>
|
|
5
|
+
<p>This is the home page using default layout.</p>
|
|
6
|
+
<NuxtLink to="/items" style="color: #2563eb; font-weight: bold;">View Books →</NuxtLink>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!-- app/pages/items/[id].vue: Dynamic Wildcard Route: /items/:id -->
|
|
2
|
+
<script setup>
|
|
3
|
+
const route = useRoute()
|
|
4
|
+
|
|
5
|
+
const books = [
|
|
6
|
+
{ id: 1, title: 'The Hobbit', author: 'J.R.R. Tolkien', desc: 'A fantasy quest across Middle-earth.' },
|
|
7
|
+
{ id: 2, title: '1984', author: 'George Orwell', desc: 'A dystopian vision of totalitarian rule.' },
|
|
8
|
+
{ id: 3, title: 'The Great Gatsby', author: 'F. Scott Fitzgerald', desc: 'The American jazz age critique.' }
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
// Extract the id from route parameters
|
|
12
|
+
const bookId = parseInt(route.params.id)
|
|
13
|
+
const book = books.find(b => b.id === bookId)
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div>
|
|
18
|
+
<div v-if="!book">
|
|
19
|
+
<h2>Book Not Found</h2>
|
|
20
|
+
<p>No book exists with ID: {{ route.params.id }}</p>
|
|
21
|
+
<NuxtLink to="/items">Back to Catalogue</NuxtLink>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div v-else>
|
|
25
|
+
<h2>{{ book.title }}</h2>
|
|
26
|
+
<h4>Author: {{ book.author }}</h4>
|
|
27
|
+
<p>{{ book.desc }}</p>
|
|
28
|
+
<hr style="margin: 15px 0;" />
|
|
29
|
+
<NuxtLink to="/items">← Back to Catalogue</NuxtLink>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!-- app/pages/items/index.vue: Route: /items -->
|
|
2
|
+
<script setup>
|
|
3
|
+
const books = [
|
|
4
|
+
{ id: 1, title: 'The Hobbit', author: 'J.R.R. Tolkien' },
|
|
5
|
+
{ id: 2, title: '1984', author: 'George Orwell' },
|
|
6
|
+
{ id: 3, title: 'The Great Gatsby', author: 'F. Scott Fitzgerald' }
|
|
7
|
+
]
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div>
|
|
12
|
+
<h2>Book Catalogue</h2>
|
|
13
|
+
<ul>
|
|
14
|
+
<li v-for="book in books" :key="book.id" style="margin-bottom: 8px;">
|
|
15
|
+
<!-- Dynamic link to /items/[id] -->
|
|
16
|
+
<NuxtLink :to="`/items/${book.id}`">
|
|
17
|
+
<strong>{{ book.title }}</strong> by {{ book.author }}
|
|
18
|
+
</NuxtLink>
|
|
19
|
+
</li>
|
|
20
|
+
</ul>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|