A simple application based on RESTful architecture that uses Express framework
The server is built with Node, Express and postgres and allows users to consume CRUD services on customer endpoint. It is a Http RESTful api that will response with JSON objects.
- clone this repository.
- Install dependencies:
npm install
ornpm i
for short. - Start the web server from the command line:
npm run start
- You can curl or use any http client app such as
Postman
to query the desired endpoints
- Querying
/customers
will return a full list of customers - Querying
/customers/<customerId>
will return a single customer with address details - Posting into
/customers
will create a new customer and return a success message - Posting into
/customers/address/:<customerId>
will create a new address and return a success message - PUT
/customers/<customerId>
will update an existing customer and return a success message - PUT
/customers/address/<customerId>
will update an existing address and return a success message - DELETE
/customers/<customerId>
will delete an existing customer and all addresses related to it - DELETE
/customers/address/<customerId>
will delete an existing address
Dependencies:
- Express
- Node 5.10.x or above
- postgres db
In order to be able to run the app and its tests, please make sure you have these dbs created: vrify-test
and vrify
with customers
and customer_addresses
tables in each of them.
id: integer(pk)
name: text
id: integer(pk)
customer_id: integer(fk - customer.id) - on delete: cascade
postal_code: text
street_address: text
countryL text
Tests are written to verify that the api endpoints are functioning as expected, they are written using Mocha framework and Chai assertion library, in order to run the tests, please use the following command:
- npm run test