Giter Club home page Giter Club logo

random-office-quotes-gen's Introduction

Random Quote Generator

This is a backend API that allows you to interact with the quotes from the TV show The Office. Sending a Get request to the base url will return a random quote along with the character who said it. There is also a /quote endpoint that allows users to interact with the quotes data via typical CRUD operations. The information for how to mass upload the quotes data to the sqlite db is below in the init DB section.

Future Improvements

This project is the result of my first 4 hours learning to use nest.js and sqlite. Some features I would have liked to add with more time are pagination and filtering on the Get operation for the /quotes endpoint, and some sort of authorizaition to update, create and delete quotes via the api. I would also probably do more extensive mock and e2e testing.

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Init DB

# create db file
$ sqlite3 quotesDB

# create table
$ CREATE TABLE IF NOT EXISTS "quotes" ("quote_id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "quote" varchar NOT NULL, "character" varchar NOT NULL);

# load all json data into db
$ INSERT INTO quotes(quote_id,quote,character) SELECT
    json_extract(value, '$.quote_id'), 
    json_extract(value, '$.quote'),
    json_extract(value, '$.character')
  FROM json_each(readfile('./src/data/office_quotes.json'));

random-office-quotes-gen's People

Contributors

adam-macioszek avatar

Watchers

 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.