GithubHelp home page GithubHelp logo

tommyteavee / rest-hotels-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lexmartinez/rest-hotels-api

0.0 1.0 0.0 185 KB

:hotel: Hotels REST API: A simple node/express API exercise with hotels information

Home Page: https://rest-hotels-api.herokuapp.com/

License: MIT License

HTML 21.55% JavaScript 78.45%

rest-hotels-api's Introduction

rest-hotels-api Build Status

๐Ÿจ REST Hotels API: A simple node/express API exercise.

Created as part of technical test for mobile dev role at Hays Recruiting - Almundo.com

Quick start

# clone repo
$ git clone https://github.com/lexmartinez/rest-hotels-api

# change directory to cloned app
$ cd rest-hotels-api

# install the dependencies with npm
$ npm install

# start dev server (with live-reload)
$ npm start

go to http://localhost:8080 in your browser.

Table of Contents

Dependencies

You'll need to run this app:

  • node and npm (Use NVM)
  • Ensure you're running Node (v8.9.4+) and NPM (5.6.0+)

Developing

After you have installed all dependencies you can now start developing with:

  • npm start

It will start a local server using nodemon which will watch, build (in-memory), and reload for you. The application can be checked at http://localhost:8080.

Environment

Environment variables must be configured into .env file located at project root

DB_URL = localhost:27017/database
DB_USER = username
DB_PASSWORD = password

Testing

In order to check the coding standard, this project has eslint integration to run it use

  • npm run test

Also going you can execute a few unit-test in order to validate the basic API operation with:

  • npm run unit-test

Production

To build your application, run:

  • npm run build

You can now go to /dist and deploy that to your server!

You also can run your compiled project locally using the command npm run serve

Service Endpoints

This REST API includes the following endpoints:

  • getCities
    GET: /v1/cities
  • getHotels
    GET: /v1/hotels
  • getHotelsByCity
    GET: /v1/hotels?city={city}
  • getHotelById
    GET: /v1/hotels/{id}

Hotel Schema

The model for our hotel objects is defined as follows:

{
    "name" : "Dummie Hotel",
    "stars" : 3,
    "images" : ["http://dummie-hotel.com/image1.jpg","http://dummie-hotel.com/image2.jpg"],
    "price" : 1596,
    "city": "Paris",
    "address": "Champ de Mars, 5 Avenue Anatole France, 75007",
    "latitude": 48.858093,
    "longitude": 2.294694,
    "country": "France",
    "description": "Sed elementum tempus tellus, a efficitur massa molestie in. Vivamus tempus libero metus, sit amet scelerisque leo mattis eu. Vestibulum et nisl maximus, consequat felis eu, varius erat. Pellentesque fermentum tincidunt dui non porttitor.",
    "website": "http://dummie-hotel.com",
    "phone": "+33 (2) 753 343 43443",
    "email": "[email protected]",
    "amenities": {
        "wifi": true,
        "pool": false,
        "spa": false,
        "parking": true,
        "ac": false,
        "restaturant": true,
        "bar": true,
        "gym": false
    }    
}

Deployment

A demo for this app is running on Heroku at

https://rest-hotels-api.herokuapp.com/

Deploy powered by TravisCI & Heroku
Dummy Generated Data powered by JSON Generator

Demo data is a lot of dummy information, thus the different addresses, locations, phones and so on not match any real hotel

License

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

rest-hotels-api's People

Contributors

lexmartinez avatar

Watchers

 avatar

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.