Skip to content

katerina-tziala/api-wood-creations-store

Repository files navigation

🚀 Wood Creations Store RESTful API

A RESTful API for an online wood creations store.

The database schema, the data contracts and the exposed API endpoints can be found in the REQUIREMENTS.md

Prerequisites

Node version >= 12.13.0 PostgreSQL or Docker.

Technologies

Here’s a high level list of the technologies used for this app:

Running the App

  1. Fork and clone this repository

  2. To install the dependencies of the app, run in the project directory npm install or npm i

  3. In the root directory of the project create a .env file based on the example.env

    The default values of the environment variables are already provided including the ports of the api(3000) and the database(5432).

  4. Set up the databases for development and testing as described in the DATABASE_SETUP.md

  5. Make sure your database is up and running

  6. To set up the database schema, in the project directory run: npm run database:up

  7. To run the app, in the project directory run: npm run dev

Code Quality and Testing

The commands to check the code quality and test the api must be run in the project directory.

Code Quality

The preferred settings for the coding style of the app can be fount in the .prettierrc and .eslintrc files.

To check the code consistensy to the chosen coding style run npm run prettier-check.

To apply the chosen coding style run npm run prettier.

To lint the app run npm run lint.

Testing

To test the app:

  1. Make sure postgress is up and running

  2. Make sure the database for testing exists

  3. In the project directory run npm run test.

Notes

Endpoints Playground

In order to experiment with and test the endpoints through the REST Client plugin for Visual Studio Code, use the provided endpoints.rest file.

In order to experiment with and test the endpoints through Postman install the app and import both the environment and the collection. Make sure you the imported environment is selected when sending the requests.

Database

For the needs of this project, when running npm run database:up to create the database schema some of the tables are filled with data:

  • Users: The admin of the store is created. To login as an admin use the following credentials:

    {
        "username": "admin",
        "password": "root"
    }
    
  • Categories: The basic categories of the products are created

  • Products: Some showcase products are created

Future Improvements

  • Increase test coverage by adding more tests.
  • Implement email verification for the new users. Unverified users should not have access to the RESTful API.
  • Implement price tracking per period for each one of the products and calculate total price of an order based on the price that the product had when the order was completed.
  • Create endpoint to allow adminstrators see active orders of specified user(s).
  • Create endpoint to allow adminstrators see statistics about customers' orders.
  • Extend user creation endpoint to allow adminstrators create new adminstrators.

Attributions

Many thanks to the designer of handmade wood creations (and friend) manukhantu for the idea of the project.

About

A RESTful API for a wood creations store

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published