/simple-book-store

Express API with PostgreSQL that supplies data to a React bookstore app.

Primary LanguageJavaScript

Simple Bookstore API

Simple Bookstore is a RESTful API built in Express.js and using PostgreSQL to store data. It follows CRUD principles and consists of the following routes:

  • /books/create - create a new book (create)
  • /books - list all books (read)
  • /books/:id - retrieve a particular book (read)
  • /books/edit/:id - update a particular book (update)
  • /books/delete/:id - delete a particular book (delete)

Getting Started

Prerequisites

You must have Node, Node Package Manager and PostgreSQL installed on your local machine.

Installing

  • Fork and clone the repository.
  • npm install to get the required dependencies.
  • npm run init:db to create, load, and seed the database.
  • You will need to create your own .env file within the project with the following line:
DATABASE_URL="postgres://localhost:5432/bookstore"
  • npm start to start the server, or npm run start:dev to run it in development mode with nodemon.

Running the tests

To run unit tests for the API queries, just run npm test after installing the dependencies. Tests are implemented in Mocha/Chai.

Deployment

This project is set up for live deployment.

Authors

License

This project is licensed under the MIT License.