Skip to content

A barebones E-Commerce boilerplate built using Express, Handlebars, and Braintree's payment API.

Notifications You must be signed in to change notification settings

notadamking/express-ecommerce-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rest API Documentation

Table of Contents

  1. Users
  2. Firms

Users:

Title: Get a user

Endpoint: GET /users/:id

URL Params:

Required

id: String

Responses

Success (200 OK)

{
  id: String,
  email: String,
  name: {
    salutation: String,
    first: String,
    middle: String,
    last: String,
    suffix: String,
  },
  fullName: String,
  stateBars: [
    {
      id: Number,
      state: String,
      admitDate: Date,
      years: Number,
    }
  ],
  department: String,
  position: String,
  firm: Firm, (see firm)
  phones: [
    {
      type: String,
      number: String,
      ext: String,
    },
  ],
}

Not Found (404 )

{ error: `No user exists with id ${id}` }

Error (500 Internal Error)

{ error: 'Oops! Something went wrong on our end!' }

Title: Create new user

Endpoint: POST /users/

Data Payload:

Required

{
  email: String,
  password: String,
  firstName: String,
  lastName: String,
  phoneNumber: String
}

Responses

Success (200 OK)

{
  id: String,
  email: String,
  name: {
    salutation: String,
    first: String,
    middle: String,
    last: String,
    suffix: String,
  },
  fullName: String,
  stateBars: [
    {
      id: Number,
      state: String,
      admitDate: Date,
      years: Number,
    }
  ],
  department: String,
  position: String,
  firm: Firm, (see firm)
  phones: [
    {
      type: String,
      number: String,
      ext: String,
    },
  ],
}

Error (409 Conflict)

{ error: 'User already exists' })

Error (400 Bad Request)

{ error: 'Email, password, firstName, lastName, and phoneNumber are required to create a new user.' }

Error (500 Internal Error)

{ error: 'Oops! Something went wrong on our end!' }

Title: Update a user

Endpoint: PUT /users/:id

URL Params

Required id: String Data Payload:

Optional

{
  email: String,
  name: {
    salutation: String,
    first: String,
    middle: String,
    last: String,
    suffix: String,
  },
  stateBars: [
    {
      id: Number,
      state: String,
      admitDate: Date,
    }
  ],
  department: String,
  position: String,
  firm: Firm, (see firm)
  phones: [
    {
      type: String,
      number: String,
      ext: String,
    },
  ],
}

Responses

Success (200 OK)

{
  id: String,
  email: String,
  name: {
    salutation: String,
    first: String,
    middle: String,
    last: String,
    suffix: String,
  },
  fullName: String,
  stateBars: [
    {
      id: Number,
      state: String,
      admitDate: Date,
      years: Number,
    }
  ],
  department: String,
  position: String,
  firm: Firm, (see firm)
  phones: [
    {
      type: String,
      number: String,
      ext: String,
    },
  ],
}

Error (403 Forbidden)

{ error: 'You do not have permission to update that user.' }

Error (500 Internal Error)

{ error: 'Oops! Something went wrong on our end!' }

Title: Remove a user

Endpoint: DELETE /users/:id

URL Params

Required id: String

Responses

Success (200 OK)

{ info: 'Successfully removed user.' }

Error (403 Forbidden)

{ error: 'You do not have permission to remove that user.' }

Error (500 Internal Error)

{ error: 'Oops! Something went wrong on our end!' }

Firms

Title: Get a firm

Endpoint: GET /firms/:id

URL Params:

Required

id: String

Responses

Success (200 OK)

{
  id: String,
  name: String,
  employerId: String,
  status: String,
  address: {
    lines: [String],
    city: String,
    state: String,
    zip: String,
    country: String,
  },
}

Error (404 Not Found)

{ error: `No firm exists with id ${id}` }

Error (500 Internal Error)

{ error: 'Oops! Something went wrong on our end!' }

Title: Create new firm

Endpoint: POST /firms/

Data Payload:

Required

{
  name: String,
}

Optional

{
  employerId: String,
  status: String,
  address: {
    lines: [String],
    city: String,
    state: String,
    zip: String,
    country: String,
  },
}

Responses

Success (200 OK)

{
  id: String,
  name: String,
  employerId: String,
  status: String,
  address: {
    lines: [String],
    city: String,
    state: String,
    zip: String,
    country: String,
  },
}

Error (409 Conflict)

{ error: 'Firm already exists' })

Error (400 Bad Request)

{ error: 'Name is required to create a new firm.' }

Error (500 Internal Error)

{ error: 'Oops! Something went wrong on our end!' }

Title: Update a firm

Endpoint: PUT /firms/:id

URL Params

Required id: String

Data Payload:

Optional

{
  name: String,
  employerId: String,
  status: String,
  address: {
    lines: [String],
    city: String,
    state: String,
    zip: String,
    country: String,
  },
}

Responses

Success (200 OK)

{
  id: String,
  name: String,
  employerId: String,
  status: String,
  address: {
    lines: [String],
    city: String,
    state: String,
    zip: String,
    country: String,
  },
}

Error (403 Forbidden)

{ error: 'You do not have permission to update that user.' }

Error (500 Internal Error)

{ error: 'Oops! Something went wrong on our end!' }

Title: Remove a firm

Endpoint: DELETE /firms/:id

URL Params

Required id: String

Responses

Success (200 OK)

{ info: 'Successfully removed firm.' }

Error (403 Forbidden)

{ error: 'You do not have permission to remove that firm.' }

Error (500 Internal Error)

{ error: 'Oops! Something went wrong on our end!' }

About

A barebones E-Commerce boilerplate built using Express, Handlebars, and Braintree's payment API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published