From ff298c37017062d5838f247bd013d8ec275e21bf Mon Sep 17 00:00:00 2001 From: Andrei Ignatiev Date: Thu, 8 Sep 2022 11:50:21 -0400 Subject: [PATCH 1/6] project changes --- README.md | 86 +------- node_modules/.bin/mime | 1 + node_modules/.package-lock.json | 18 ++ node_modules/mime/CHANGELOG.md | 296 ++++++++++++++++++++++++++++ node_modules/mime/LICENSE | 21 ++ node_modules/mime/Mime.js | 97 +++++++++ node_modules/mime/README.md | 187 ++++++++++++++++++ node_modules/mime/cli.js | 46 +++++ node_modules/mime/index.js | 4 + node_modules/mime/lite.js | 4 + node_modules/mime/package.json | 52 +++++ node_modules/mime/types/other.js | 1 + node_modules/mime/types/standard.js | 1 + package-lock.json | 30 +++ public/car.jpeg | Bin 0 -> 153603 bytes public/css/style.css | 4 +- public/index.html | 149 ++++++++++++-- server.improved.js | 30 ++- 18 files changed, 930 insertions(+), 97 deletions(-) create mode 120000 node_modules/.bin/mime create mode 100644 node_modules/.package-lock.json create mode 100644 node_modules/mime/CHANGELOG.md create mode 100644 node_modules/mime/LICENSE create mode 100644 node_modules/mime/Mime.js create mode 100644 node_modules/mime/README.md create mode 100755 node_modules/mime/cli.js create mode 100644 node_modules/mime/index.js create mode 100644 node_modules/mime/lite.js create mode 100644 node_modules/mime/package.json create mode 100644 node_modules/mime/types/other.js create mode 100644 node_modules/mime/types/standard.js create mode 100644 package-lock.json create mode 100644 public/car.jpeg diff --git a/README.md b/README.md index f229958..ed7c217 100644 --- a/README.md +++ b/README.md @@ -6,93 +6,27 @@ Due: September 8th, by 11:59 AM. This assignment aims to introduce you to creating a prototype two-tiered web application. Your application will include the use of HTML, CSS, JavaScript, and Node.js functionality, with active communication between the client and the server over the life of a user session. -Baseline Requirements ---- - -There is a large range of application areas and possibilities that meet these baseline requirements. -Try to make your application do something useful! A todo list, storing / retrieving high scores for a very simple game... have a little fun with it. - -Your application is required to implement the following functionalities: - -- a `Server` which not only serves files, but also maintains a tabular dataset with 3 or more fields related to your application -- a `Results` functionality which shows the entire dataset residing in the server's memory -- a `Form/Entry` functionality which allows a user to add, modify, or delete (complete at least two) data items residing in the server's memory -- a `Server Logic` which, upon receiving new or modified "incoming" data, includes and uses a function that adds at least one additional derived field to this incoming data before integrating it with the existing dataset -- the `Derived field` for a new row of data must be computed based on fields already existing in the row. -For example, a `todo` dataset with `task`, `priority`, and `creation_date` may generate a new field `deadline` by looking at `creation_date` and `priority` - -Your application is required to demonstrate the use of the following concepts: - -HTML: -- One or more [HTML Forms](https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms), with any combination of form tags appropriate for the user input portion of the application -- A results page displaying all data currently available on the server. You will most likely use a `` tag for this, but `
+ + + +
+ +
+ +

+ Kurtz's Cars! +

+

+ Automobiles for admirers of the road +

+ +
+

+ Enter your vehicle information here: +

+
- - -
- +
+ + + + +
+
    + + diff --git a/server.improved.js b/server.improved.js index 26673fc..bc6e13e 100644 --- a/server.improved.js +++ b/server.improved.js @@ -7,11 +7,12 @@ const http = require( 'http' ), port = 3000 const appdata = [ - { 'model': 'toyota', 'year': 1999, 'mpg': 23 }, - { 'model': 'honda', 'year': 2004, 'mpg': 30 }, - { 'model': 'ford', 'year': 1987, 'mpg': 14} + { 'model': 'toyota', 'year': 1999, 'mileage': 205724}, + { 'model': 'dodge', 'year': 2004, 'mileage': 172057 }, + { 'model': 'ford', 'year': 1987, 'mileage': 299690} ] + const server = http.createServer( function( request,response ) { if( request.method === 'GET' ) { handleGet( request, response ) @@ -23,7 +24,7 @@ const server = http.createServer( function( request,response ) { const handleGet = function( request, response ) { const filename = dir + request.url.slice( 1 ) - if( request.url === '/' ) { + if( request.url === '/' || request.url === "/?" ) { sendFile( response, 'public/index.html' ) }else{ sendFile( response, filename ) @@ -38,12 +39,25 @@ const handlePost = function( request, response ) { }) request.on( 'end', function() { - console.log( JSON.parse( dataString ) ) - // ... do something with the data here!!! - + var inD = JSON.parse( dataString ) + console.log(inD) + if(inD.action === "add"){ + nC = {model: inD.model, year: inD.year, mileage: inD.mileage} + appdata.push(nC) + } + console.log(appdata) + if(inD.action === "delete"){ + const trashBin = appdata.splice(inD.index, 1) + } + theYear = new Date().getFullYear() + for(k = 0; k Date: Thu, 8 Sep 2022 11:59:34 -0400 Subject: [PATCH 2/6] added glitch link --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ed7c217..81ba26f 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ The project of: Andrei Ignatiev: alignatiev@wpi.edu +Glitch: http://a2-alignatiev.glitch.me ## Kurtz's Cars Automobile Repository From 6fe407f7d8dd06de3cdf8e20d402a4f93703f8a4 Mon Sep 17 00:00:00 2001 From: Andrei Ignatiev Date: Thu, 8 Sep 2022 12:06:32 -0400 Subject: [PATCH 3/6] glitch just in case --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 81ba26f..0109bb7 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ The project of: alignatiev@wpi.edu Glitch: http://a2-alignatiev.glitch.me +back-up Glitch: https://glitch.com/~a2-alignatiev + ## Kurtz's Cars Automobile Repository From e6c6d12ab7d079ac924b69a32c6eca3c02f968f9 Mon Sep 17 00:00:00 2001 From: Andrei Ignatiev Date: Wed, 14 Sep 2022 22:13:35 -0400 Subject: [PATCH 4/6] css investigation --- public/css/style.css | 73 ++++++++++++++++++++++++++++++++++++++ public/index.html | 83 +++++++++++--------------------------------- 2 files changed, 94 insertions(+), 62 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 3d42c46..b585957 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,3 +1,76 @@ /*Style your own assignment! This is fun! */ +html { + min-width: 600px; +} +.container { + display: flex; + margin: auto; + background-color: gainsboro; + font-family: 'Catamaran', sans-serif; + justify-content: left; + flex-direction: column; + width: 1200px; + margin-left: 20px; +} +.button { + font-family: 'Catamaran', sans-serif; + font-size: 1.2rem; + border: 1px; +} +.button:hover { + color:rgb(219, 21, 90); +} +.add_div{ + border-radius: 5px; + /*background-color: white;*/ +} +.outT{ + border-radius: 5px; + /*background-color: white;*/ +} +.main{ + border-radius: 5px; + /*background-color: white;*/ +} +div{ + border-radius: 5px; + /*background-color: white;*/ +} +form { + padding: 15px; + border-radius: 5px; + display: flex; + flex-direction: column; +} +input { + height: 30px; + font-family: "Raleway", sans-serif; + font-size: 1rem; +} +table{ + border-style:dotted; + align-items: center; + border-color: firebrick; + border: 4px; +} +img{ + border: 2px + dotted firebrick; + width: 300px; + align-items: center; +} +h1{ + color:navy; + font-family: 'Catamaran', sans-serif; + } +h2{ + font-size: smaller; + font-family: 'Catamaran', sans-serif; +} +button{ + font-family: 'Catamaran', sans-serif; + font-size: 1.2rem; + border: 0; +} diff --git a/public/index.html b/public/index.html index a7c56a2..7be45b6 100644 --- a/public/index.html +++ b/public/index.html @@ -6,78 +6,36 @@ - - + x - - + +
    - +
    - -

    - Kurtz's Cars! -

    -

    - Automobiles for admirers of the road -

    - -
    -

    - Enter your vehicle information here: -

    +

    Kurtz's Cars!

    +

    Automobiles for admirers of the road

    +

    Enter your vehicle information here:

    -
    +
    - + +
    +
    +
      -
        - + From c4c032e7725d17b062a4c22fc5d9c1819ea0af7d Mon Sep 17 00:00:00 2001 From: Andrei Ignatiev Date: Wed, 14 Sep 2022 22:21:12 -0400 Subject: [PATCH 5/6] no more x --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 7be45b6..cf43192 100644 --- a/public/index.html +++ b/public/index.html @@ -6,7 +6,7 @@ - x + From d1ffe8fa7b8cda38b7fa500728208b96e6113620 Mon Sep 17 00:00:00 2001 From: Andrei Ignatiev Date: Wed, 14 Sep 2022 22:39:22 -0400 Subject: [PATCH 6/6] html fixes --- public/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index cf43192..f71eca1 100644 --- a/public/index.html +++ b/public/index.html @@ -12,7 +12,7 @@
        - + a car
        @@ -20,7 +20,7 @@

        Kurtz's Cars!

        Automobiles for admirers of the road

        Enter your vehicle information here:

        -
        +