https://github.com/sendistephen/shopping_basket_api
This is a shopping basket rest API written in Node.js with the help of the express.js framework
https://github.com/sendistephen/shopping_basket_api
expressjs mongodb mongoose nodejs rest-api
Last synced: 2 months ago
JSON representation
This is a shopping basket rest API written in Node.js with the help of the express.js framework
- Host: GitHub
- URL: https://github.com/sendistephen/shopping_basket_api
- Owner: sendistephen
- Created: 2019-06-03T11:41:47.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T08:57:31.000Z (over 3 years ago)
- Last Synced: 2025-02-24T01:50:32.052Z (over 1 year ago)
- Topics: expressjs, mongodb, mongoose, nodejs, rest-api
- Language: JavaScript
- Homepage: https://shopping-basket-api.vercel.app
- Size: 3.75 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SHOPPING BASKET REST API
[](https://travis-ci.org/sendistephen/shopping_basket_api) [](https://codeclimate.com/github/sendistephen/shopping_basket_api/maintainability) [](https://app.codacy.com/app/sendistephen/shopping_basket_api?utm_source=github.com&utm_medium=referral&utm_content=sendistephen/shopping_basket_api&utm_campaign=Badge_Grade_Dashboard) [](https://coveralls.io/github/sendistephen/shopping_basket_api) [](https://github.com/facebook/jest) [](https://github.com/facebook/jest)
Shopping Basket is an application that helps users create a list of items they want to buy so that they can keep track of them
## Documentation
This is the link to the api documentation [here](https://shoppingbasketapi.docs.apiary.io/)
## Key Features
- User can create an account and login
- User can create,view,update and delete a shopping basket
- User can create, view update and delete an item from a shopping basket
## Tools
- [Apiary](https://apiary.io/) - used for documenting the api
- [Express.js](https://expressjs.com/) - a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
- [MongoDB](https://www.mongodb.com/) - MongoDB is a document database with the scalability and flexibility of querying and indexing data
- [Mongoose](https://mongoosejs.com) - Mongoose is an Object Data Modeling (ODM) library for MongoDB and Node.js
- [Jest](https://jestjs.io/docs/en/getting-started) - Jest is an open JavaScript testing library from Facebook
- [Node]() - Node is JavaScript run-time environment that executes JavaScript code outside of a browser
## Getting started
Make sure you have Node.js(v10.16.0), npm(v6.9.0) & mongodb installed on your machine
### Clone this repository and cd into it
```sh
git clone https://github.com/sendistephen/shopping_basket_api.git && cd shopping_basket_api
```
### Install all project dependencies
```sh
npm install
```
### Mongo connection setup
Edit your /config/default.json file to include the correct MongoDB URI
### Setup environment variables
Copy and paste the info below in your terminal respectively
MAC
```sh
export shoppingbasket_secretOrPrivateKey=yoursecretkey
```
WINDOWS
```sh
set shoppingbasket_secretOrPrivateKey=yoursecretkey
```
### Start the Application
```sh
npm run dev # Runs on http://localhost:9000
```
### To run tests
```sh
npm run test
```
### Working Endpoints
| Endpoint | Functionality | Access |
| ----------------------------------- | -------------------------------------------------------- | ------- |
| POST /api/v1/users | Registers a User | Public |
| POST /api/v1/auth | Login a user | Public |
| POST /api/v1/baskets | Create a new basket | Private |
| GET /api/v1/baskets | Get all baskets created by user. | Private |
| PUT /api/v1/baskets/:id | Updates a basket with a given id | Private |
| GET /api/v1/baskets/:id/items | Gets items of a specific basket given its id | Private |
| POST /api/v1/baskets/:id/items | Adds items to a specific basket with the given basket id | Private |
| DELETE /api/v1/baskets/:id/item/:id | Deletes an item from the basket | Private |
| PUT /api/v1/baskets/:id/item/:id | Updates a basket item on a given basket | Private |