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:
Pugtemplate -
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
pugfiles 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
viewsfolder.
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
configand replace the DB information in filedevelopment.env - To run at local:
- Run
npm run start:api:devto start api - Run
npm run watch:js:devto start bundling js/html/css for dev env. - Go to
localhost:3001to open web page.
- Data file is placed under
fixtureData, run the apiPOST localhost:3001/api/v1/test-data/create-fixtureto 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 useGmailservice and following the setup in herehttps://stackoverflow.com/a/45479968to know how to generate password