Code Monkey home page Code Monkey logo

memory-1's Introduction

Galvanize Memory

You're making an API that can list, create, read, update, and delete a collection of New Year's resolutions. The problem is that you're missing a critical part of the API-- the database! Create a database for this API, and interface with it via Knex.js.

Setup

Make a local database and setup a knexfile to connect to it.

Migrate

Make a migration that creates the following database table:

resolution

key name data type
PK id auto-incrementing integer
dueDate date
resolution text

Seed

Seed your database with some data:

field value
id 1
dueDate "1997-02-01"
resolution "Go skiing"
field value
id 2
dueDate "1997-05-01"
resolution "Do stand-up"
field value
id 3
dueDate "1997-09-01"
resolution "Start knitting"

Make sure your next auto-incrementing integer starts with 4!

Database connection

Make a connection to your database in the database-connection.js file with the appropriate environment data.

Queries

Fill out the queries.js file with the following:

  • list() should return a promise that resolves with all of the data in the resolution table as an array
  • read(id) should return a promise that resolves with the record with a matching id as an object
  • create(resolution) should return a promise that inserts a resolution object and resolves to the created database record as an object
  • update(id, resolution) should return a promise that updates a resolution record matching id with the data in resolution and resolves to the updated database record as an object
  • delete(id) should return a promise that removes the record matching id and resolves to nothing

Deployment

Deploy this API. Note that you'll need to create a remote database, run your migration and seeds on it, and connect to it in production and your local database in development.

Notes

  • You can test your API locally with npm test

Add a link to your deployed API here.

memory-1's People

Contributors

trujilloj avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.