Code Monkey home page Code Monkey logo

restful-booker's Introduction

restful-booker

A simple Node booking form for testing RESTful web services.

Requirements

  • Docker 17.09.0
  • Docker Compose 1.16.1

Installation

  1. Ensure mongo is up and running by executing mongod in your terminal
  2. Clone the repo
  3. Navigate into the restful-booker root folder
  4. Run npm install
  5. Run npm start

Or you can run this via Docker:

  1. Clone the repo
  2. Navigate into the restful-booker root folder
  3. Run docker-compose build
  4. Run docker-compose up
  5. APIs are exposed on http://localhost:3001

API

API details can be found on the publically deployed version of Restful-Booker.

restful-booker's People

Contributors

dependabot[bot] avatar ham1 avatar kobenguyent avatar mwinteringham avatar puskunalis avatar sheymouse avatar thywen avatar vidhya-manojkumar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

restful-booker's Issues

Getting 404 in local environment

Hello Mark,

I'm trying to get the API running on my Windows 10 Machine, I installed the MongoDB first as suggested.
After that I installed NPM.

I cloned the repository, executed mongod, npm install, npm start commands. I've not received any error messages.
I can open the http://localhost:3001/ in my browser and it shows the same page as on the herokuapp.
But when I try to execute the GET command on http://localhost:3001/ping in Postman, I get an HTTP 404 error.

POST //auth 404 17.347 ms - 9
Error: Not Found
    at C:\Users\Gabor_Zorad\Work\restful-booker-main\app.js:23:15
    at Layer.handle [as handle_request] (C:\Users\Gabor_Zorad\Work\restful-booker-main\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (C:\Users\Gabor_Zorad\Work\restful-booker-main\node_modules\express\lib\router\index.js:328:13)
    at C:\Users\Gabor_Zorad\Work\restful-booker-main\node_modules\express\lib\router\index.js:286:9
    at Function.process_params (C:\Users\Gabor_Zorad\Work\restful-booker-main\node_modules\express\lib\router\index.js:346:12)
    at next (C:\Users\Gabor_Zorad\Work\restful-booker-main\node_modules\express\lib\router\index.js:280:10)
    at C:\Users\Gabor_Zorad\Work\restful-booker-main\node_modules\express\lib\router\index.js:646:15
    at next (C:\Users\Gabor_Zorad\Work\restful-booker-main\node_modules\express\lib\router\index.js:265:14)
    at Function.handle (C:\Users\Gabor_Zorad\Work\restful-booker-main\node_modules\express\lib\router\index.js:175:3)
    at router (C:\Users\Gabor_Zorad\Work\restful-booker-main\node_modules\express\lib\router\index.js:47:12) {
  status: 404
}

Do you know what can cause this issue?

If I just open the http://localhost:3001/ping in Chrome, it works perfectly fine.

Thanks in advance!

Can't get it running

After cloning the project I tried it both with Docker and NodeJS.

Error message of Docker:

C:\local\restful-booker (master) 
λ docker-compose build
Building restful-booker
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "compose\cli\main.py", line 64, in main
  File "compose\cli\main.py", line 116, in perform_command
  File "compose\cli\main.py", line 222, in build
  File "compose\project.py", line 307, in build
  File "compose\service.py", line 786, in build
  File "site-packages\docker\api\build.py", line 205, in build
  File "site-packages\docker\utils\decorators.py", line 47, in inner
  File "site-packages\docker\api\client.py", line 171, in _post
  File "site-packages\requests\sessions.py", line 522, in post
  File "site-packages\requests\sessions.py", line 475, in request
  File "site-packages\requests\sessions.py", line 596, in send
  File "site-packages\requests\adapters.py", line 423, in send
  File "site-packages\requests\packages\urllib3\connectionpool.py", line 595, in urlopen
  File "site-packages\requests\packages\urllib3\connectionpool.py", line 363, in _make_request
  File "httplib.py", line 1042, in request
  File "httplib.py", line 1082, in _send_request
  File "httplib.py", line 1038, in endheaders
  File "httplib.py", line 882, in _send_output
  File "httplib.py", line 844, in send
  File "site-packages\docker\transport\npipeconn.py", line 31, in connect
  File "site-packages\docker\transport\npipesocket.py", line 22, in wrapped
  File "site-packages\docker\transport\npipesocket.py", line 50, in connect
pywintypes.error: (2, 'WaitNamedPipe', 'The system cannot find the file specified.')
docker-compose returned -1

Error message of NodeJS (before that i did "npm install"):

C:\local\restful-booker (master) 
λ npm start

> [email protected] start C:\local\restful-booker
> node ./bin/www


events.js:163
      throw er; // Unhandled 'error' event
      ^
MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
    at Pool.<anonymous> (C:\local\restful-booker\node_modules\mongodb-core\lib\topologies\server.js:328:35)
    at emitOne (events.js:96:13)
    at Pool.emit (events.js:191:7)
    at Connection.<anonymous> (C:\local\restful-booker\node_modules\mongodb-core\lib\connection\pool.js:274:12)
    at Object.onceWrapper (events.js:293:19)
    at emitTwo (events.js:106:13)
    at Connection.emit (events.js:194:7)
    at Socket.<anonymous> (C:\local\restful-booker\node_modules\mongodb-core\lib\connection\connection.js:177:49)
    at Object.onceWrapper (events.js:293:19)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at emitErrorNT (net.js:1283:8)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\local\\node-win-x64\\node.exe" "C:\\local\\node-win-x64\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v7.9.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the restful-booker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs restful-booker
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls restful-booker
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\tx2mz\AppData\Roaming\npm-cache\_logs\2017-04-27T10_48_26_225Z-debug.log

The API via web authentication problem

Hi there! Great work, I came across this repository today and it looks great.

This issue might not be an issue at all. As far as I understand, the API hosted on herokuapp can be used for learning purpose and I can even authenticate myself to the API to add new entries (which will be cleared every ten minutes).

I tried to authenticate with the username and password given in the documentation but server responses with the message that credentials are wrong. Did I misunderstand? Authentication is possible only when I will build the API on my device or it is able through the web too?

Auth response doesn't match documentation

The response from the API is (something like):
{"token":"4435e80661e070c"}
whereas the documentation simply states the response should be (something like):
VHgTAuGPxvMsH1p

Incorrect Booking Dates saved

As of the most recent commit, bookingdates are getting saved as one day later than what was input. I'm assuming it has to do with updating dateformat dependency, but it is all javascript to me. :)

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.