ソースを参照

Updated README.md, changed output file name to public.

justinformentin 3 年 前
コミット
c29d5e9df5
3 ファイル変更25 行追加4 行削除
  1. 23 2
      README.md
  2. 0 0
      public/index.html
  3. 2 2
      rollup.dev.js

+ 23 - 2
README.md

@@ -20,6 +20,10 @@ The `db.json` file is the "database" for the project that contains all of the st
 
 The `server.js` file creates a `jsonServer` using the `db.json` file as the data, and is accessible through `localhost:3000`.
 
+The `/public/index.html` is the file that will be served by the server, and available on `localhost:8000`.
+
+When running `npm run dev` rollup will bundle all of your code into a single file `index.js` that will be placed in `/public`.
+
 ## Data Structure
 
 The `db.json` file contains a list of users, a list of chat rooms, and a list of comments.
@@ -36,27 +40,44 @@ Create a chat room using Web Components. There should be a way to send comments,
 
 1. Add TypeScript interfaces/types that you think are useful.
 2. Create a `sendComment` method.
+
    a. The method should be accessible when importing the built file.
+
    b. To send a comment, make a POST request to localhost:3000/comments/
+
    b. The POST request should have a body that contains the properties "comment", "room_id", "sender_name", "sender_id".
+
    c. The method should return a Promise that resolves the sent comment, or rejects an error.
 
 3. Create a `getComments` method.
+
    a. The method should be accessible when importing the built file.
+
    b. Must take a room id as an argument.
-   c. Must return a Promise that resolves an array of comments
+
+   c. Must return a Promise that resolves an array of comments.
+
    d. To get chat_rooms, make a GET request to localhost:3000/chat-rooms/
+
    e. To get comments, make a GET request to the chat_rooms `comments_url` property.
-   f. Array of resolved comments must contain only comments with `event: "created"` - remove the comments with the `event: "deleted"`
+
+   f. Array of resolved comments must contain only comments with `event: "created"` - remove the comments with the `event: "deleted"`.
+
    g. Each comment with an `event: "deleted"` will have an `id` property. This `id` property matches a single comment with the `event: "created"` property.
+
    h. Comment items that have an `id` that matches an `event: "deleted"` comments must have their message property changed to "This message has been removed".
 
 4. There should be a chat-room element that renders the list of comments
    a. It should take a `roomid` attribute, and the matching set of comments should be rendered.
+
    b. If the `roomid` attribute is changed, it should update to render the correct matching set of comments.
+
    c. It should take a `userid` attribute, and the matching user data should be used to send comments.
+
    d. If the `userid` attribute does not match any existing user, a new user should be created.
+
    e. If the `userid` attribute changes, the chat-room element should update to use the correct matching user data when sending comments.
+
    e. Only the comments with `event: "created"` properties should be rendered.
 
 Example comment list for getComments method and chat-room element rendering:

+ 0 - 0
dist/index.html → public/index.html


+ 2 - 2
rollup.dev.js

@@ -7,9 +7,9 @@ tasks[0].plugins.push(
   serve({
     host: "localhost",
     port: 8000,
-    contentBase: ["dist"],
+    contentBase: ["public"],
   })
 );
-tasks[0].plugins.push(livereload({ watch: "dist" }));
+tasks[0].plugins.push(livereload({ watch: "public" }));
 
 export default tasks;