0% found this document useful (0 votes)
7 views4 pages

Recruitment Project

The document outlines a Recruitment Workflow Management Project consisting of a backend server using Express and MongoDB for job postings, applications, and interviews, along with a frontend interface for job listings and application submission. It includes models for Job, Application, and Interview, and provides RESTful API endpoints for CRUD operations. The frontend consists of HTML, CSS, and JavaScript to display job listings and handle application submissions.

Uploaded by

vinayaksingh90
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Recruitment Project

The document outlines a Recruitment Workflow Management Project consisting of a backend server using Express and MongoDB for job postings, applications, and interviews, along with a frontend interface for job listings and application submission. It includes models for Job, Application, and Interview, and provides RESTful API endpoints for CRUD operations. The frontend consists of HTML, CSS, and JavaScript to display job listings and handle application submissions.

Uploaded by

vinayaksingh90
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Recruitment Workflow Management Project

Backend - server.js
const express = require('express');
const mongoose = require('mongoose');
const cors = require('cors');

const app = express();


app.use(express.json());
app.use(cors());

mongoose.connect('mongodb+srv://yourusername:[email protected]/recruitment',
{ useNewUrlParser: true, useUnifiedTopology: true })
.then(() => console.log('MongoDB Connected'))
.catch(err => console.log(err));

const Job = require('./models/Job');


const Application = require('./models/Application');
const Interview = require('./models/Interview');

app.post('/jobs', async (req, res) => {


const job = new Job(req.body);
await job.save();
res.json(job);
});

app.get('/jobs', async (req, res) => {


const jobs = await Job.find();
res.json(jobs);
});

app.post('/applications', async (req, res) => {


const application = new Application(req.body);
await application.save();
res.json(application);
});

app.get('/applications', async (req, res) => {


const applications = await Application.find();
res.json(applications);
});

app.post('/interviews', async (req, res) => {


const interview = new Interview(req.body);
await interview.save();
res.json(interview);
});

app.get('/interviews', async (req, res) => {


const interviews = await Interview.find();
res.json(interviews);
});

app.listen(5000, () => console.log('Server running on port 5000'));

Backend - models/Job.js
const mongoose = require('mongoose');

const JobSchema = new mongoose.Schema({


title: String,
company: String,
description: String,
location: String
});

module.exports = mongoose.model('Job', JobSchema);

Backend - models/Application.js
const mongoose = require('mongoose');

const ApplicationSchema = new mongoose.Schema({


candidateName: String,
candidateEmail: String,
resumeLink: String,
jobId: mongoose.Schema.Types.ObjectId,
interviewDate: Date
});

module.exports = mongoose.model('Application', ApplicationSchema);

Backend - models/Interview.js
const mongoose = require('mongoose');

const InterviewSchema = new mongoose.Schema({


candidateName: String,
candidateEmail: String,
jobId: mongoose.Schema.Types.ObjectId,
jobTitle: String,
interviewDate: Date
});

module.exports = mongoose.model('Interview', InterviewSchema);

Frontend - index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Job Listings</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Job Listings</h1>
<div id="job-list"></div>
<script src="script.js"></script>
</body>
</html>

Frontend - apply.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Apply for Job</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Apply for a Job</h1>
<form id="apply-form">
<input type="text" id="name" placeholder="Your Name" required>
<input type="email" id="email" placeholder="Your Email" required>
<input type="text" id="resume" placeholder="Resume Link" required>
<input type="datetime-local" id="interviewDate" required>
<button type="submit">Submit Application</button>
</form>
<script src="script.js"></script>
</body>
</html>

Frontend - style.css
body {
font-family: Arial, sans-serif;
margin: 20px;
}

h1 {
text-align: center;
}

form {
display: flex;
flex-direction: column;
width: 300px;
margin: auto;
}

input, button {
margin: 10px 0;
padding: 10px;
}

Frontend - script.js
fetch('http://localhost:5000/jobs')
.then(response => response.json())
.then(jobs => {
const jobList = document.getElementById('job-list');
jobs.forEach(job => {
jobList.innerHTML += `
<div>
<h2>${job.title}</h2>
<p>${job.company} - ${job.location}</p>
<a href="apply.html">Apply</a>
</div>
`;
});
});

document.getElementById('apply-form')?.addEventListener('submit', function(event) {
event.preventDefault();

const applicationData = {
candidateName: document.getElementById('name').value,
candidateEmail: document.getElementById('email').value,
resumeLink: document.getElementById('resume').value,
interviewDate: document.getElementById('interviewDate').value
};

fetch('http://localhost:5000/applications', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(applicationData)
})
.then(response => response.json())
.then(data => alert("Application Submitted!"))
.catch(error => console.error('Error:', error));
});

You might also like