The application is about Booking Tour website
, it helps end-user to review and book designed tours.
The code/ideas of the application are following from the Udemy course Node.js, Express, MongoDB & More
(author: Jonas Schmedtmann). (Note that: I am student of the course )
-
Programming language: Using Typescript is the main programming language at Back-end site, which is different from the original course.
-
Database: MongoDB, with database-driver is mongoose.
-
Rest-api framrwork: Express v4
-
View enginee:
Pug
template -
Payment gateway: Stripe
-
Testing framework and tool: Playwright
-
Bundling tool: Using Esbuild
-
Model folder is data-model of the business entities:
user
,review
,tour
,booking
-
Controller folder is the business layer used to process logic of the application
-
Views folder is the presentation layer used to render the UI interface to user, it consists
pug
files to HTML file -
Routes folder is the routing of the rest-api services.
-
Public folder is the folder containing static files as HTML/css/image files. It is used to integrated with the
views
folder.
Using Playwright as Testing framework to perform integration testing (black-box approach) and UI test.
-
All test specs are placed under
./tests
-
Playwright configuration is defined on file
playwright.config.ts
-
To run the test
-
Start the API server for the corresponding environment:
npm run start:api:dev
-
Run the api test specs:
npm run test:api:dev
-
Run the UI test specs: TBD
Playwright test case design approach and how to use it
- The application is deployed into the Heroku
https://natoursudemy.herokuapp.com/
- Git clone my app
- Go to folder
config
and replace the DB information in filedevelopment.env
- To run at local:
- Run
npm run start:api:dev
to start api - Run
npm run watch:js:dev
to start bundling js/html/css for dev env. - Go to
localhost:3001
to open web page.
- Data file is placed under
fixtureData
, run the apiPOST localhost:3001/api/v1/test-data/create-fixture
to seed data, then use the account info on fileusers.test.json
- To reduce the cost, the mail-service is used at Dev environment is
mailtrap
. For the PROD, please useGmail
service and following the setup in herehttps://stackoverflow.com/a/45479968
to know how to generate password