Skip to content

Instantly share code, notes, and snippets.

@cklanac
cklanac / Javascript OO Cheat Sheet
Last active January 9, 2026 17:24
Javascript OO Cheat Sheet
/***********************************************************************************************************************
***********************************************************************************************************************
* CONTENTS:
* Native Object
* Object Literal
* Basic Object
* Psuedo-Class
* Self Executing/Invoking Structure
* Lazy Function
* Module Pattern
@cklanac
cklanac / shopping-list-api.md
Created November 16, 2016 22:25
Creating a Shopping List API

Creating a Shopping List API

In this lesson you will be using your Node.js and Express skills to create the back end for a simple Shopping List application. The application will allow users to add, read, update and remove shopping items. You'll learn about the CRUD model and RESTful APIs, then put this into practice when creating the back end.

Goals

  • Understand the basics of CRUD and REST
  • Create RESTful endpoints which perform all of the CRUD operations

Intro to REST and CRUD

@cklanac
cklanac / cicd-config-clicker.md
Last active July 20, 2025 07:51
CICD: Travis CI and Heroku Instructions: 2 Versions - Point-n-Click and CLI Ninja

Setup Travis and Heroku CICD: Point-n-Click

Continuous Integration with Travis CI

Configure travis.yml

  • Run npm test to ensure tests are working correctly locally
  • Create .travis.yml file in repo
  • Add the following to configure for node
@cklanac
cklanac / challenge-01-node-and-express.md
Last active July 20, 2025 07:50
Challenge 01: Node Express Basics

For this challenge, you'll clone the starter repo, install express, setup a static server and create 2 endpoints to serve Notes. The starter repo contains a simple in-memory database with sample data and a client application to demonstrate the API.

Requirements

  • Clone and setup the starter repo
  • Install express and setup a start command
  • Implement an Express static server
  • Create 2 GET endpoints:
    • GET notes returns a list of notes. If a search term is provided it returns a filtered list, otherwise it returns a full list of notes.
    • GET a note by ID returns a specific note based on the ID provided.
@cklanac
cklanac / challenge-03-restful-and-routers.md
Last active July 20, 2025 07:50
Challenge 03: RESTful and Express Routers

For this challenge, you'll add the save and delete features. And, you'll move the endpoints into a router.

Requirements

  • Swap out the custom logger with Morgan
  • Move endpoints to an Express Router
  • Implement save a new Note feature
  • Implement delete a Note feature

Before getting started, remember to create a development branch git checkout -b feature/restful-routers to hold your work.

@cklanac
cklanac / challenge-04-promises.md
Last active July 20, 2025 07:50
Challenge 04: Promises

For this challenge, you'll update both the client and the server to use promises.

On the client, you will change the API methods to return promises instead accepting callbacks. Then update the api.METHOD() calls to use promises.

On the server, you will update simDb to use promises, we'll provide the code. Then update the queries to use promises instead of callbacks.

Requirements

  • Update the server-side code
  • Update the simDb.js file with "promisified" version
@cklanac
cklanac / challenge-mocha-chai-travis.md
Last active July 20, 2025 07:49
Challenge 05: Testing with Mocha Chai

For this challenge you will create a full suite of tests that confirm your app is working correctly. Then you'll setup Continuous Integration to ensure your app continues to work.

Requirements

  • Install mocha, chai and chai-http
  • Update server.js to support tests
  • Create a suite of tests:
    • Test that the environment
    • Test the static server
  • Test the endpoints
@cklanac
cklanac / challenge-10-postgres-testing.md
Last active July 20, 2025 07:48
Challenge 10: Knex JS Testing

Noteful Challenge - Integration Testing

In this challenge you will re-implement testing on the Noteful app, this time we a real database. And you'll update the tests to cross-check the API results against the database.

Requirements

  • NPM install devDependencies for testing and update package.json file
  • Update server.js to prevent app.listen from running during tests
  • Add a test property to knexfile.js
  • Create a test database
@cklanac
cklanac / challenge-09-many-to-many.md
Last active June 26, 2024 18:32
Challenge 09: KnexJS with Many-to-Many

Noteful Challenge - Many-to-Many

In this challenge you will create a tags and notes_tags table which will setup a many-to-many relationship between notes and tags. You'll also create a new router to perform CRUD operations on the tags, and update the existing notes endpoints to work with tag related data.

Requirements

Add tags and notes_tags table and relationships

To get started, let's update the .sql script from the previous challenges. Create a tags table and define 2 fields in the schema.

@cklanac
cklanac / mac-setup.md
Last active February 26, 2024 04:17
Mac setup

Mac Setup Distilled

Install Chrome, Dev and Canary

Description of Chrome Channels

  • Install Chrome or Chrome Dev
    • Note: Chrome and Chrome Dev use the same profile on a Mac
  • Setup 2 profiles:
    • Browsing: It may contain bookmarks, personal settings and extenstions