GithubHelp home page GithubHelp logo

phase-3-challenge-c's Introduction

part-1: Simple web app

GET and POST routes

While in the part-1 directory:

Install dependencies with npm install

Start the server with npm start

GET Route:

GET a captialized word with three exclamation points: localhost:3000/api/shout/:word

Example:

curl -i localhost:3000/api/shout/exclamation responds with

HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: text/html; charset=utf-8
Content-Length: 14
ETag: W/"e-tu4eRkYs96MrbZq+SZhH+3rquGE"
Date: Mon, 14 Aug 2017 23:19:06 GMT
Connection: keep-alive

EXCLAMATION!!!%

POST Route:

POST a JSON object of arrays 'a' and 'b' at localhost:3000/api/array/merge with Postman or curl and get a concatenation of those two arrays back.

Example: curl -i -d '{"a": [3, 4], "b": [5, 6]}' -H "Content-Type: application/json" localhost:3000/api/array/merge

the response is:

HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 20
ETag: W/"14-60MbenLelCbzwVNvhqb1QT6onyU"
Date: Mon, 14 Aug 2017 23:11:04 GMT
Connection: keep-alive

{"result":[3,4,5,6]}%

If either a or b are not an array, the response is:

HTTP/1.1 400 Bad Request
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 47
ETag: W/"2f-1iH/kbeeTzEPFBNZpx/VIKCvQZg"
Date: Mon, 14 Aug 2017 23:17:58 GMT
Connection: keep-alive

{"error":"Input data should be type of array."}%

part-2: Command Line Hotel Management System

While in the part-2 directory:

Install dependencies with npm install

Create the database schema with npm run-script schema

In load-data.sql put full paths to seed data in the COPY statements then use npm run-script load to load the seed data

After doing this, you'll be able to interact with the database with the following commands (arguments in brackets are optional):

1) node ./hotel.js guests

lists all guest information

Example (first 5 rows of results):

ID      Guest Name                    Email
--------------------------------------------------------------
1      Aurthur Velti                [email protected]
2      Kurtis Pougher                [email protected]
3      Randy Thys                [email protected]
4      Charlton Millson                [email protected]
5      Onida Reinhard                [email protected]

2) node ./hotel.js rooms [--available]

lists all rooms ./hotel.js rooms

or available rooms only node ./hotel.js rooms --available

Example (first 5 rows of results):

Room #  Capacity     Available
--------------------------------
2A      2             true
2B      3             true
2C      2             true
2D      6             true
3A      2             true

(note: room availability can be updated each day with npm run-script update )

3) node ./hotel.js bookings [<room #>]

lists all upcoming bookings node ./hotel.js bookings

or upcoming bookings of a specific room number node ./hotel.js bookings <room #>

Example without room number (first 5 rows):

Room #  Guest Name                Check-In                 Check-Out
---------------------------------------------------------------------
5A      Billi Coyne             2017-08-12                 2017-08-26
3A      Chicky Bouldon             2017-08-18                 2017-08-31
5A      Janie Powers             2017-08-18                 2017-08-28
3A      Kurtis Pougher             2017-08-27                 2017-09-03
3F      Chicky Bouldon             2017-09-30                 2017-10-10

Example with room number (node ./hotel.js bookings 3D):

Room #  Guest Name                     Check-In                  Check-Out
--------------------------------------------------------------------------
3D      Averil Sawkin               2018-01-09                 2018-01-11

Additionally, the test folder contains a file of database query tests that can be run with npm test

part-3: Web interface for hotel manager

The part-3 directory contains: An HTML page that simulates a web interface for booking hotel rooms and the corresponding CSS, and JavaScript files. It does not interact with a database.

phase-3-challenge-c's People

Contributors

smithrm941 avatar

Watchers

 avatar  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.