Skip to content

Estate360/Hotel_Management_API_TypeScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hotel_Management_API_TypeScript

This is my first application of Typescript in NodeJs And it is live on Render😎

Hotel Management API (TypeScript) This is a RESTful API built with TypeScript, Node.js, and MongoDB for managing hotel rooms and reservations. The API allows users to perform various actions, such as creating, updating, deleting rooms, and viewing all rooms available.

Technologies Used

Getting Started Locally To use this API, you will need to have Node.js and MongoDB installed on your computer. Then, follow these steps:

  1. Run git clone https://github.com/Estate360/Hotel_Management_API_TypeScript.git to clone the repository to your local machine.

  2. Run cd Hotel_Management_API_TypeScript to navigate to the cloned repository directory.

  3. Install the required dependencies:

  4. Run npm install to install the required dependencies. npm start

  5. Run npm run start-dev to start the server. The server will start running at http://localhost:8000 or http://localhost:5000. You can now use this API to perform various actions.

Hosted Link:

https://estate-room-ease-server.onrender.com

API Endpoints

This API provides the following endpoints:

Authentication Methods

Room types Methods

Rooms Methods

Examples and possible responses (error messages)

  • Create a new user: Request enter the following on the body;
{
  "name":"Will Smith",
  "email":"willsmith@gmail.com",
  "password":"0000000000",
  "confirmPassword":"0000000000"
}

Response;

  {
  "message": "User successfully created.",
  "token": "token appears here",
  "data": {
    "newUser": {
      "name": "Will Smith",
      "email": "willsmith@gmail.com",
      "role": "guest",
      "active": true,
      "_id": "63fd0edfae3348c5cb28f52b",
      "createdAt": "2023-02-27T20:13:19.195Z",
      "updatedAt": "2023-02-27T20:13:19.195Z",
      "__v": 0
    }
  }
}

(By default, you get the role of "guest" except if specified)

if user already exists, the error responds becomes;

{
  "error": "User already exists"
}

Note that the email and password fields are required for the login using POST link just as provided https://estate-room-ease-server.onrender.com/api/v1/users/login. You'll be provided with a token when you input the correct email and password.

Also note that the token provided on login will be used carry out other functionalities like creation of roomTypes, rooms, deleting, editing etc... if you are an "admin" user.

Contributing

If you're interested in contributing to this project, please feel free to fork the repository and make any changes you like. Once you're ready, submit a pull request to have your changes reviewed and merged into the main branch.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Leave a Star ⭐️ if you find this helpful or worth a Start

About

This is my first application of Typescript in NodeJs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published