shawnyu5 / fragments Goto Github PK
View Code? Open in Web Editor NEWProject repo for seneca CPP555
Project repo for seneca CPP555
Great to see you using TS! One issue: npm WARN deprecated [email protected]: TSLint has been deprecated in favor of ESLint. Please see palantir/tslint#4534 for more ***rmation. You should migrate
You shouldn't need to do this in your Fragment class, it should happen in the auth middleware (I gave you code to do it in the weekly hints) https://github.com/shawnyu5/fragments/blob/master/src/model/fragments.ts#L14
Use Buffer for your type on the data https://github.com/shawnyu5/fragments/blob/master/src/model/fragments.ts#L119
Because you update these, you need to re-.save() the fragment too https://github.com/shawnyu5/fragments/blob/master/src/model/fragments.ts#L128-L129
You can use Request, Response, etc. from the Express.js types for these https://github.com/shawnyu5/fragments/blob/master/src/routes/api/post.ts#L8
https://github.com/shawnyu5/fragments/blob/master/src/routes/api/post.ts#L11 is wrong. This should already be parsed by the passport middleware, and available via req.user
https://github.com/shawnyu5/fragments/blob/master/src/routes/api/post.ts#L13-L14 can throw, and anything that can throw, will eventually throw. You need try/catch
Why do this, when you already have a reference to the fragment from above? https://github.com/shawnyu5/fragments/blob/master/src/routes/api/post.ts#L16
Instead of this https://github.com/shawnyu5/fragments/blob/master/src/routes/api/post.ts#L18 do: res.json({...})
Same issue here: use req.user https://github.com/shawnyu5/fragments/blob/master/src/routes/api/get.ts#L7
fragment vs. fragments (only one when you get by id) https://github.com/shawnyu5/fragments/blob/master/src/routes/api/get.ts#L22-L24 Also, error handling
Dockerfile
and .dockerignore
added to fragments
GitHub repoDockerfile
employs Docker best practices for creating Docker ImagesDockerfile
uses a multi-stage Docker Build produces, producing the smallest possible production Docker Image of your fragments
node serverfragments
Docker image is hosted as a public repository at Docker Hub under your accountfragments
Docker image automatically built and pushed to Docker Hub on every new commit to the main
branch via GitHub Actions CI workflowPOST /fragments
can now create any text/*
or application/json
fragments (i.e., you don't need to support images until Assignment 3), with unit tests. See 4.3.GET /fragments?expand=1
now returns expanded fragment metadata for an authenticated user. See 4.4.1.GET /fragments/:id
returns an existing fragment's data with the expected Content-Type
, with unit tests. See 4.5.GET /fragments/:id/info
returns an existing fragment's metadata, with unit tests. See 4.7.GET /fragments/:id.ext
returns an existing fragment's data converted to a supported type. Initial, you only need to support Markdown fragments (.md
) converted to HTML (.html
) using markdown-it (i.e., you don't have to do other conversions until Assignment 3)fragments
Docker container is running manually on EC2 using pre-built Docker Hub image (i.e., without building manually on EC2)NOTE: your web UI does not need to be polished or pretty, but must be functional, even if only in a very basic way. Remember, this is only for manual testing.
Dockerfile
and .dockerignore
added to fragments-ui
GitHub repoDockerfile
employs Docker best practices for creating Docker ImagesDockerfile
uses a multi-stage Docker Build produces the smallest possible production Docker Imagenginx
to serve the final static web site vs. node.jsfragments-ui
Docker image hosted as a public repository at Docker Hub under your account. NOTE: you don't need to automate this, pushing it manually is fine (you're obviously welcome to automate it if you want to).text/*
) or JSON application/json
fragment type should work. You could have the user type the fragment's content into a simple textbox, or support drag-and-drop, or use some of the many browser file APIs. It's up to you, but there needs to be some way to accomplish this. NOTE: this doesn't need to be fancy or highly polished; this is only for manual testing.console
or dynamically generate UI elements like a table or list). It's up to you what you do, but there needs to be some way to accomplish this.Create a technical summary report document (e.g., Word or PDF) and submit it to Blackboard. This document will discuss and demonstrate your progress to date on implementing the fragments
service.
In your report, include all of the following sections and items. Make sure that any screenshots are properly explained with words as well:
fragments
API server running as a container on EC2 based on your Docker Hub image (i.e., shows health check JSON response in the browser or via curl
)fragments-ui
web app running on localhost and connecting to your Docker Container running on EC2 and your Amazon Cognito User Pool, doing the following:
Location
header being set and returned correctlynpm run coverage
to show that you've been able to properly cover the majority of your files and lines of code. Make sure your coverage rate is high enough to reflect proper testing for all units of code (>80% and includes all source files in this release).Please make sure that all of the following items have been successfully completed, based on the Fragments Microservice Specification.
fragments
, DynamoDB Local, and S3 LocalStack containers together in development and GitHub Actions CI workflow for integration testingdocker-compose
properly set-up with scripts to easily run themmain
branch via GitHub Actions CI workflowfragments
server data model configurable via .env
to run using either MemoryDB
or AWS (S3, DynamoDB)POST /fragments
can create any supported text, image or JSON fragments, with tests. See 4.3.PUT /fragments:id
can update an authenticated user's existing fragment, with tests. See 4.6.DELETE /fragments/:id
can delete an authenticated user's existing fragment, with tests. See 4.8.GET /fragments/:id.ext
allows conversion of all fragment types to other supported types. Image conversions use sharp module.ext
, with testsfragments
Docker image automatically built and pushed to Amazon Elastic Container Registry (ECR) on every new git Tag via GitHub Actions CD workflowfragments
Docker container automatically deployed to Elastic Beanstalk using pre-built Amazon ECR Docker image on every git tag via GitHub Actions CD workflowfragments
server logs are streamed to Amazon CloudWatchYou are asked to submit two things:
A short document listing all necessary resources in your system, specifically:
fragments
API servernpm run coverage
to show that you've been able to properly cover the majority of your files and lines of code. Make sure your coverage rate is high enough to reflect proper testing for all units of code (>80% and includes all necessary files).A video demonstration and walk-through of your system, uploaded as a private video to YouTube (i.e., only the people you share the URL with will be able to see it). The presentation video should be between 5-10 minutes in length (no longer). It should include audio of you talking and a screen-capture of all the elements you discuss (i.e., you don’t have to be on camera if you aren’t comfortable doing so, it’s up to you). Use the video to give a walk-through of your final, completed system and all the technologies it uses.
Your walkthrough should include the following:
fragments
API server running on AWS Elastic Beanstalk (i.e., shows health check JSON response, with AWS EC2 URL in the browser or via curl
)fragments-ui
web app running on localhost and connecting to a Docker Container running on AWS Elastic Beanstalk and your Amazon Cognito User Pool, doing the following:
Submit the URL to your YouTube video, and try accessing it in an Incognito/Private Browser Window to make sure it's accessible to your professor.
Source control should not include /build
directory
GET /fragments
supporting both with ?expand=1
and without, with testsGET /:id/info
with testsA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.