Skip to content

aelyakoubi/Backend-Node.js-bed-final-bookingsite-API

Repository files navigation

organogram_bedfinal

🚀 How to Get Started

You can clone the repository, install dependencies, and run the app using the following steps:

🧱 1. Install Frontend/Backend Dependencies

(Open Terminal 1)

npm install
npm install har-validator@latest   # If needed
npm install uuid@latest            # If needed
npm audit fix                      # Optional, to fix vulnerabilities
npm run dev                        # Starts the app on default dev port (e.g., 3000)

🧭 2. Start Prisma Studio

(Open Terminal 2 in parallel)

npx prisma studio

⚙️ Setting Up Environment Variables

Create a .env file in the root directory and add your own keys (if not already included):

AUTH_SECRET_KEY=your_secret_key_here
SENTRY_DSN=your_sentry_dsn_here

✅ Running Tests

Tests are executed using Newman, a CLI tool for running Postman collections. The test flow mimics real API calls — such as validating success codes (200, 201) or failure (404, etc.).

Steps to Run Tests:

  1. Start the server Run in the project root:

    npm run dev
  2. Verify Postman Environment Configuration Navigate to the postman/environments folder. You’ll find a file like this:

    {
      "key": "baseUrl",
      "value": "http://0.0.0.0:3000",
      "enabled": true
    }

    ⚠️ If your server uses a different port or URL, update baseUrl accordingly.

  3. Run Tests

    npm run test

You’ll see the test results directly in the terminal. Behind the scenes, this command runs a Postman collection stored in the postman/ folder as defined in your package.json.


⚠️ Important Notes:

  • Data-sensitive Tests: Some tests use DELETE endpoints, which means they modify the database. Always restart the server (npm run dev) before rerunning tests.
  • Be cautious with test accounts or sample data, especially if tied to registration/auth endpoints.

Positive API integrationtest 2025-05-04 213712 Negative API integrationtest 2025-05-04 213807 bed-final-repository_image03 image image

About

BACK-END Bedfinal Bookingsite : JavaScript, Prisma, Node.js, MySQL, Error handling, Authentication, Routes, Api, CRUD 'method'

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published