A full-stack React module that recreates the listing details section of an vacation rental listing page, including:
- Overview (title, type, location, host, capacity)
- Highlights
- Description
- Amenities
- Sleeping arrangements
- House rules
- Cancellation policy
- Video tour
Each of these components is populated with mock data for 100 listings. See a sample of data sent to the client here: https://gist.github.com/bcronin2/4b220cb71d18c3ca3a94afa0b39f33c9
- https://github.com/Vacationly/navigation
- https://github.com/Vacationly/reviews
- https://github.com/Vacationly/bookings
- https://github.com/Vacationly/photos
This module is built on a MERN (Mongo, Express, React, Node) stack.
- Node >=6.7.0 (runtime environment)
- npm >=6.0 (dependency manager)
- MongoDB >=3.0 (database)
- axios (sending API requests from client)
- body-parser (handling requests on server)
- cors (handling cross-origin requests from proxy)
- css-modules (modular styles)
- express (server framework)
- faker (data generation)
- mongoose (database connections)
(running/watching server)
- prop-types (validating component data)
- react (component library)
- react-dom (rendering component)
- react-icons (rendering special icons)
An nvmrc file is included if using nvm.
This module is set up to run locally at localhost:3001/listing/[id from 1 to 100].
You can run this module either (1) with NPM scripts from local files, or (2) from a container on DockerHub (see more below).
By default, the static js bundle is served from S3. To serve from localhost, change the appropriate commented-out lines in public/index.html.
In order to run with npm, you need to:
- Install dependencies
- Seed your database
- Build client bundle.js, locally and/or to S3
- Run the server
NOTE: All commands below to be run from within the root directory
npm install -g webpack
npm installnpm run seednpm run build:devNOTE: The files built in this way will only be served if you change the script tags used in public/index.html.
npm run build:prodNOTE: To build to S3, you will need to set up your own bucket and include an .aws.json file in this repo with your credentials.
npm run startNOTE: This uses nodemon, so changes will update the server environment automatically.
In order to run with Docker, you need to:
- Create your own image on DockerHub, updating the
package.jsonanddocker-compose.ymlfiles accordingly - Build your image to DockerHub
- Run the
docker-composefile - Modify some of the scripts further if you want to work out of a locally Dockerized version
NOTE: You must modify the
build:dockerscript inpackage.jsonto create images in your own account. For example: Current script:docker build . -t bcronin2/fec-airbnh-details && docker push bcronin2/fec-airbnh-detailsYour script:
docker build . -t YOUR_NAME/fec-airbnh-details && docker push YOUR_NAME/fec-airbnh-detailsYou must also update line 5 in
docker-compose.ymlwith this new tag.
npm run build:dockerdocker-compose up [-d] ('-d' for detached mode, i.e., running in background)npm run testNOTE: The __test__ folder only contains API tests and config files; other integration tests and unit tests of components are in client/components. The command above runs tests from both locations.
npm run lint