Skip to content

KemalBekir/CakeShop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

CakeShop

Welcome to CakeShop. Web application for a boutique cake shop where you can order one of our standart cakes or you can order a custom one. We offer cakes for all kinds of occasions(birthday, weddings, engagements, hen and stag do).

Tech

Installation

Install the dependencies and devDependencies and start the server.

cd server
npm i
npm start

Install the dependencies in client and start.

cd client
npm i
npm start

REST_API Endpoints:

baseUrl: http://localhost:5000

Login

Login by sending a POST request with email and password to /users/login. The service will respond with an object, containing a standard string token, that can be used for requests.

Register

Create a new user by sending a POST request to /users/register with properties username, email, password and tel as an optional property. The service automatically creates a session and returns an authorization token, that can be used for requests.

Logout

Send an authorized GET request to /users/logout. The service returns an empty response - if you attempt to parse it as JSON, you will receive an error! You can check for this type of response by looking at the status (204 instead of 200) and the content-type header (will not be present).

Authorized Requests

To make an authorized request, add the following header, where {token} is the access token, returned by the service upon successful login or registration:

X-Authorization: {token}

Get User Details

Send an authorized GET request to /users/profile. The service will return the record of the user, associated with the passed-in session token.

Update User Details

This request requires authorization and content-type headers. Only the owner of the resource can edit it. Send an authorized PUT request to /users/profile.

Content-Type: application/json

X-Authorization: {token}

[Request body]


Get Chat

This request requires authorization and content-type headers. Only the owner of the resource can edit it. Send an authorized GET request to /message/:chatId

Content-Type: application/json

X-Authorization: {token}

[Request body]


Post Chat

This request requires authorization and content-type headers. Only the owner of the resource can edit it. Send an authorized POST request to /message/:chatId

Content-Type: application/json

X-Authorization: {token}

[Request body]

  • Send POST request to /message/:chatId to create a new message. If chat with this ID does not exist, it will be created. Request body must contain, content, chatId, token.

CRUD

Read

An end point is revealed at /catalog, which grants access to information, stored on the service. GET requests to the service will return the following responses:

  • GET /catalog/ - array of all entries in the collection; will return 404 if collection does not exist
  • GET /catalog/top5 - array of latest 5 entries in the collection
  • GET /catalog/deals - array of all cakes that are on offer
  • GET /catalog/search - array of cakes by name or type

Create

Only available for Admin user.

This request requires authorization and content-type headers

Content-Type: application/json

X-Authorization: {token}

[Request body]

  • Send POST request to /catalog/ to create new entry. Request body must contain, name, description, price, type, imgOne, imgTwo, imgThree, imgFour, onOffer, discount. ID will be generated automatically and will be included in the returned object. If the collection does not exist, it will be created.

Update

Only available for Admin user.

This request requires authorization and content-type headers. Only the owner of the resource can edit it.

Content-Type: application/json

X-Authorization: {token}

[Request body]

  • Send PUT request to /catalog/:id to update a single entry. Note that the existing entry will be replaced!

Delete

Only available for Admin user.

This request requires authorization headers. Only the owner of the resource can delete it.

Content-Type: application/json

X-Authorization: {token}

[Request body]

  • Send DELETE request to /catalog/:id to delete a single entry.

Screenshots

CakeShop Web App

Desktop
CakeShop Desktop 1 CakeShop Desktop 2 CakeShop Desktop 3
CakeShop Desktop 4 CakeShop Desktop 5 CakeShop Desktop 6
CakeShop Desktop 7 CakeShop Desktop 8 CakeShop Desktop 9
CakeShop Desktop 10 CakeShop Desktop 11

Tablet

Image 1 Image 2 Image 3
Image 4 Image 5 Image 6
Image 7 Image 8 Image 9

Mobile

mobile1 mobile2 mobile3
mobile4 mobile5 mobile6
mobile7 mobile8