Skip to content

raveenrv904/Job-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Node.js Job Management API

This Node.js project implements an API for managing job-related data. It provides endpoints for retrieving, creating, updating, and deleting job information.

## Getting Started

### Prerequisites

- Node.js installed
- MongoDB instance running

### Installation

1. Clone the repository:

   ```bash
   git clone <repository_url>
   ```
  1. Install dependencies:

    cd <project_folder>
    npm install
  2. Set up environment variables:

    • Create a .env file based on the provided .env.example file.
    • Configure MongoDB URI and other necessary environment variables.
  3. Start the server:

    npm start

Endpoints

GET /jobs

  • Description: Fetches all jobs created by the logged-in user.
  • Request: No parameters required.
  • Response:
    • job: An array containing job objects.
    • count: Number of jobs fetched.

GET /jobs/:id

  • Description: Retrieves a specific job by its ID.
  • Request:
    • id: ID of the job to retrieve.
  • Response:
    • job: The job object found.

POST /jobs

  • Description: Creates a new job.
  • Request Body:
    • company: Name of the company for the job.
    • position: Position/title of the job.
    • Other optional job details.
  • Response:
    • job: The newly created job object.

PATCH /jobs/:id

  • Description: Updates an existing job by its ID.
  • Request:
    • id: ID of the job to update.
    • Request Body: Fields to update (company, position, etc.).
  • Response:
    • job: The updated job object.

DELETE /jobs/:id

  • Description: Deletes a job by its ID.
  • Request:
    • id: ID of the job to delete.
  • Response: No content.

Error Handling

  • The API handles common errors such as invalid requests, missing data, and not found cases with appropriate HTTP status codes and error messages.

Libraries Used

  • express: Web framework for Node.js.
  • mongoose: MongoDB object modeling tool.
  • http-status-codes: Utility to work with HTTP status codes.

Contributing

Feel free to contribute by submitting issues or pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.


About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published