Code Monkey home page Code Monkey logo

fakejobs-api's Introduction

Fake Jobs API

The Fake Jobs API is a stateless API created using Node.js and Express.js. It utilizes a JSON data source as a database and provides CRUD (Create, Read, Update, Delete) functionality for job listings.

Purpose

This API is designed to help frontend developers integrate job listing functionality into their applications. It serves as a backend service for managing job data, allowing developers to focus on building frontend interfaces without worrying about backend logic.

Usage

Developers can use this API to create applications for various purposes, including:

  • Portfolio websites: Showcase job listing functionality in frontend portfolios.
  • Proof of concept projects: Quickly prototype job-related applications using dummy data.
  • Learning projects: Practice frontend development skills by integrating with a backend API.

Deployed Base URL

Endpoints

Get all jobs

  • Endpoint: /jobs
  • Method: GET
  • Description: Fetches all job listings.
  • Usage: Send a GET request to /jobs to retrieve all job listings.
  • Response: An array of job objects.

Note

This API will return 30 job listing objects.


Get a specific job by ID

  • Endpoint: /jobs/:id
  • Method: GET
  • Description: Fetches a specific job listing by its ID.
  • Usage: Send a GET request to /jobs/:id, where :id is the ID of the job you want to retrieve.
  • Response: The job object with the specified ID. If no job is found, a 404 response is returned with a message indicating that no job was found with the provided ID.

Create a new job listing

  • Endpoint: /jobs
  • Method: POST
  • Description: Adds a new job listing.
  • Usage: Send a POST request to /jobs with the details of the new job in the request body.

Note

You can include id in the body but still backend will generate new id value for id property for the created new job listing.

  • Example for Body of the request:
{
  "id": "1",
  "title": "Senior Front-End Developer",
  "type": "Full-Time",
  "location": "New York, NY",
  "description": "Join our team as a Senior Front-End Developer in the heart of New York City. We are looking for an experienced individual with a passion for cutting-edge technologies and a track record of delivering high-quality web applications.",
  "salary": "$100K - $120K",
  "company": {
      "name": "Tech Innovations Inc",
      "description": "Tech Innovations Inc is a leading technology company specializing in software development and digital solutions. Our team is dedicated to pushing the boundaries of innovation to deliver exceptional products and services.",
      "contactEmail": "[email protected]",
      "contactPhone": "555-123-4567"
  }
}
  • Response: If successful, returns a success message along with the newly created job object. If there's an error, an appropriate error message is returned.
  • Example of success response:
{
    "success": true,
    "msg": "Job Created Successfully!",
    "job": {
        "id": "197666",
        "title": "Senior Front-End Developer",
        "type": "Full-Time",
        "location": "New York, NY",
        "description": "Join our team as a Senior Front-End Developer in the heart of New York City. We are looking for an experienced individual with a passion for cutting-edge technologies and a track record of delivering high-quality web applications.",
        "salary": "$100K - $120K",
        "company": {
            "name": "Tech Innovations Inc",
            "description": "Tech Innovations Inc is a leading technology company specializing in software development and digital solutions. Our team is dedicated to pushing the boundaries of innovation to deliver exceptional products and services.",
            "contactEmail": "[email protected]",
            "contactPhone": "555-123-4567"
        }
    }
}

Update an existing job listing

  • Endpoint: /jobs/:id
  • Method: PUT
  • Description: Updates an existing job listing by its ID.
  • Usage: Send a PUT request to /jobs/:id, where :id is the ID of the job you want to update, with the updated job details in the request body.

Note

You can include id in the body but still backend will ignore that and update the other properties as per request body. If you don't include the id property then at the end id property with the value of :id will be added.

  • Example for Body of the request:Make sure to include the value of the properties with updated data.
{
  "id": "1",
  "title": "Senior Front-End Developer",
  "type": "Full-Time",
  "location": "New York, NY",
  "description": "Join our team as a Senior Front-End Developer in the heart of New York City. We are looking for an experienced individual with a passion for cutting-edge technologies and a track record of delivering high-quality web applications.",
  "salary": "$100K - $120K",
  "company": {
      "name": "Tech Innovations Inc",
      "description": "Tech Innovations Inc is a leading technology company specializing in software development and digital solutions. Our team is dedicated to pushing the boundaries of innovation to deliver exceptional products and services.",
      "contactEmail": "[email protected]",
      "contactPhone": "555-123-4567"
  }
}
  • Response: If successful, returns a success message along with the updated job object. If no job is found with the provided ID, a 404 response is returned with a message indicating that no job was found.
  • Example of success response:
{
    "success": true,
    "msg": "Job with id 1 has been updated",
    "job": {
        "id": "1",
        "title": "Senior Front-End Developer",
        "type": "Part-Time",
        "location": "New York, NY",
        "description": "Join our team as a Senior Front-End Developer in the heart of New York City. We are looking for an experienced individual with a passion for cutting-edge technologies and a track record of delivering high-quality web applications.",
        "salary": "$100K - $120K",
        "company": {
            "name": "Tech Innovations Inc",
            "description": "Tech Innovations Inc is a leading technology company specializing in software development and digital solutions. Our team is dedicated to pushing the boundaries of innovation to deliver exceptional products and services.",
            "contactEmail": "[email protected]",
            "contactPhone": "555-123-4567"
        }
    }
}
  • Example of 404 not found response:
{
    "success": false,
    "msg": "Job not found!"
}

Delete a job listing

  • Endpoint: /jobs/:id
  • Method: DELETE
  • Description: Deletes a job listing by its ID.
  • Usage: Send a DELETE request to /jobs/:id, where :id is the ID of the job you want to delete.
  • Response: If successful, returns a success message along with the deleted job object. If no job is found with the provided ID, a 404 response is returned with a message indicating that no job was found.
  • Example of success response:
{
    "success": true,
    "msg": "Job with id 1 has been deleted",
    "job": {
        "id": "1",
        "title": "Senior Front-End Developer",
        "type": "Full-Time",
        "location": "New York, NY",
        "description": "Join our team as a Senior Front-End Developer in the heart of New York City. We are looking for an experienced individual with a passion for cutting-edge technologies and a track record of delivering high-quality web applications.",
        "salary": "$100K - $120K",
        "company": {
            "name": "Tech Innovations Inc",
            "description": "Tech Innovations Inc is a leading technology company specializing in software development and digital solutions. Our team is dedicated to pushing the boundaries of innovation to deliver exceptional products and services.",
            "contactEmail": "[email protected]",
            "contactPhone": "555-123-4567"
        }
    }
}
  • Example of 404 not found response:
{
    "success": false,
    "msg": "Job not found!"
}

Note

The cache will be automatically cleared every 4 minutes, resetting all API data to its initial state. Consequently, any CRUD operations performed within this timeframe will be reverted, ensuring that API responses consistently reflect the initial data state.

Contribution Guidelines:

Feel free to Star✨ the repository. Fork🤩, explore🔍 and contribute🧙‍♂️ to any existing issues or initiate a new one to begin your contributions.
There's ample opportunity to enhance FakeJobs-Api with a variety of functional APIs awaiting implementation.

We expect all contributors to abide by the terms of our Code of Conduct.
Head over to our issue tracker to check more about it.
Check the Contributing Guide out.

🛡️ License:

This repository is licensed under the MIT license

GitHub watchers GitHub forks GitHub Repo stars GitHub issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.