/Circle-Ci-POC

An example of how CircleCI can be used in a simple CI/CD pipeline

Primary LanguageJavaScriptMIT LicenseMIT

Circle CI POC

Open in Visual Studio Code

This is a clone of a REST API I created to understand Express/Postgres/Jest/Supertest a little more, the original repo is here.

In this repo I have recreated all the original CI/CD steps that I created for Github Actions in CircleCI. This is a POC to learn about CircleCI and how I can implement it in my projects.


Eden is a mock plant shop. It is an example of a very basic REST API with integration tests. My hope is to make a test framework that can be scaled.

Installation

Ensure you have Node & NPM installed.

npm install
docker-compose up -d

Usage

See the package.json for all available commands

# Set up the database

# Create the sb
npm run db:create

# Set up the tables
npm run migrate

# Set up some very basic seeded data 
npm run seed
# General server use

# Start the server using nodemon
npm start 

# returns all plants
curl localhost:3000/api/plants

# returns a specific plant
curl localhost:3000/api/plants/1

# Adds a plant to the db
curl -X POST localhost:3000/api/plants\
    -H 'Content-Type: application/json'\
   -d '{"species": "Boston Fern","colour": "Green","size": "S","season": true}'

# Update a plant in the db
curl -X PUT localhost:3000/api/plants/1\
    -H 'Content-Type: application/json'\
   -d '{"species": "Cactus","colour": "Purple","size": "L","season": false}'

# Delete a plant in the db
curl -X DELETE localhost:3000/api/plants/1
# Using the test suite

# Run all tests
npm test

# Update the snapshots
npm test -- -u

# Start Jest in interactive watch mode
npm test -- --watch

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT