联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2025-02-15 12:19

CMPUT 401: Assignment

Winter 2025

The goal of this assignment is to get you acquainted with the technical aspects of the web app development process. In this assignment, you will build a simple REST API and deploy it to a Cybera Rapid Access Cloud instance. This assignment will also get you acquainted with GitHub basics. You are free to choose any programming language, and use any frameworks, packages, modules, libraries, and any database management system.

GitHub

GitHub Classroom assignment invitation link:https://classroom.github.com/a/j92ybbve

•    Click the link above to create a repository that you will use for this assignment.

•    You will create an issue titled “News API” .

•    You must work off a branch and merge your branch into the “main” branch with a pull request.

•    You must merge the pull request you created into your “main” branch with a phrase that closes the issue you created. DO NOT delete the first branch after merging the pull request and closing the issue.

•    This GitHub repository shouldn’t have anymore commits after the deadline of the assignment.

•    Naming conventions are an important point specially when working in teams, make sure to choose and follow a specific convention for your commit messages, branch names, and other names. Usually in different companies, the convention is already defined or when working in teams a specific convention is agreed upon. For your personal use make sure to check out different conventions before choosing one. Using a unified convention makes your GitHub page look more professional.

Endpoints

Get the current top headlines for Canada

•    For this assignment we are going to use thiswebsiteto get updated news.

•    Please Sign up to the website, you will get a free API key right away.

•    Please don’t input the data manually, your code should do that for you!

•    Store the first 20 news articles for Canada on Jan 1st  2025.

•    Update: You can use this link as there were some questions about other formats.

•    Although the sample response has the following fields, do not save them all (delete url and

urltoimage). When added to the dataset each one of the articles should be assigned a unique ID (this is different from the source id field just leave that as it is) that will be used in other API

calls. Do not save url and urlToImage.

{

"status": "ok",

"totalResults": 1,

"articles": [

{

"source": {

"id": null,

"name": "Contemporist.com" },

"author": "Erin",

"title": "A Dark Brick Exterior For A Home Surrounded By Trees",

"description": "Scott Posno Design has shared photos of a modern home they recently completed in

Vancouver, Canada, that showcases a dark brick exterior.",

"url": "https://www.contemporist.com/a-dark-brick-exterior-for-a-home-surrounded-by-trees/",

"urlToImage": "https://www.contemporist.com/wp-content/uploads/2024/10/modern-house-dark-brick- exterior-181024-1108-01a.jpg",

"publishedAt": "2025-01-01T16:57:10Z",

"content": "Scott Posno Design has shared photos of a modern home they completed in Vancouver, Canada, that showcases a dark brick exterior.\r\nThe house presents a series of stacked, dark brick volumes that create … [+1297 chars]"

} ]

}

Get News List

http://[ipv6 address]/news (GET)

{

"status": "ok",

"totalResults": 20, "articles": [

{

"id": 1, {

"source": { "id": null,

"name": "Contemporist.com" },

"author": "Erin",

"title": "A Dark Brick Exterior For A Home Surrounded By Trees",

"description": "Scott Posno Design has shared photos of a modern home they recently completed in Vancouver, Canada, that showcases a dark brick exterior.",

"publishedAt": "2025-01-01T16:57:10Z",

"content": "Scott Posno Design has shared photos of a modern home they completed in Vancouver, Canada,that showcases a dark brick exterior.\r\nThe house presents a series of stacked, dark brick

volumes that creat … [+1297 chars]"

}, {

"id": 2,

{

"source": { "id": null,

"name": "Forbes"

},

"author": "Jon McGowan, Contributor, \n Jon McGowan, Contributor\n https://www.forbes.com/sites/jonmcgowan/",

"title": "Canada Seeks Input On New Greenwashing Law That Will Impact US Businesses",   "description": "The Canadian Competition Bureau has released a draft of proposed guidelines

regulating environmental claims in marketing and is seeking feedback from impacted businesses.", "publishedAt": "2025-01-01T00:17:29Z",

"content": "Canadian flag flutters against a blue sky in Richmond Hill, Ontario Canada, on February 11, 2023. ... [+] (Photo by Creative Touch Imaging Ltd./NurPhoto via Getty

Images)\r\nNurPhoto via Getty Images\r\n … [+4671 chars]"

}  ]   }

Update News

http://[ipv6 address]/news/{id} (PUT)

Sample request structure (all fields must be supplied):

{

"source": { "id": null,

"name": "Bringatrailer.com" },

"author": "bringatrailer",

"title": "2007 Porsche 911 GT3",

"description": "This 2007 Porsche 911 GT3 spent time in California prior to being exported to Japan, and it was imported to Canada in 2024. Finished in black over black leather and Alcantara upholstery, it is powered by a 3.6-liter flat-six linked with a six-speed manual tra…",

"publishedAt": "2025-01-01T19:40:14Z",

"content": "This 2007 Porsche 911 GT3 spent time in California prior to being exported to Japan,

and it was imported to Canada in 2024. Finished in black over black leather and Alcantara upholstery, it is powere [+2914 chars]"

}

Successful Response structure:

{

"status": 200,

"message": "News Updated" }

Modify News

http://[ipv6 address]/news/{id} (PATCH)

Sample request structure (any fields of the PUT method can be supplied):

{

"author": "bringatrailer"

}

Successful Response structure:

{

"status": 200,

"message": "News Modified" }

Delete News

http://[ipv6 address]/status/{id} (DELETE)

Successful Response structure:

{

"status": 200,

"message": "News Deleted" }

If you delete a few of the articles it is fine and you do not need to get them again, you can do that api call once and store the top 20 and delete some of it for test.

API Documentation

•    Use your framework/library of choice to auto-generate API documentation using the OpenAPI standard.

•    The API documentation must be available at http://[ipv6 address]/docs.

•    The API documentation must be valid OpenAPI Spec.

Deployment

•    The system must be deployed on your personal Cybera RAC instance (not the instance you have for your group project).

•    Many web frameworks include some kind of development server that you can use to run your app

during development quickly. For example, in Django, you can easily run your app using python manage.pyrunserver

•    Do NOT use a development server for deployment (e.g., if you useDjango REST Framework,   you can not run it on your server using the command above). This way is great for development purposes, but it is a horrible idea to do it in production for several reasons:

1.   It is not secure

2.   It cannot handle multiple requests well (i.e., it's VERY slow)

3.   You would need to manually restart your server if something happens (your operating system can't take care of this)

•    You need to deploy your API. There are many ways to do it, and it depends on the framework you choose. Use a web server like Nginx, or Apache. You should find a tutorial for your

framework.

Your server must be listening on port 8080.

Deliverables

We are using GitHub Classroom for this assignment. You must have your code in the GitHub repository associated with the assignment.

Mandatory Files

In addition to your code, you must create four files (pay attention to file text-case and spelling) in your root directory.

1. cybera.txt, containing the IPv6 address of your personal Cybera instance with the deployed API. NOTE THAT THERE IS NO HTTP(S), it is purely the IPV6 address. Don’t include anything else in this file.

Example of the text file contents:

2001:0db8:85a3:0000:0000:8a2e:0370:7334

2. README.md, containing brief information about the framework, programming language, and DBMS that you used, each on a separate line (there should be 3 lines, don’t include

anything else in this file):

Framework Language    DBMS

Example of README.md:

Rocket Rust

MongoDB

3. LICENSE, containing an appropriate license for your code. Refer to these instructions:

https://help.github.com/articles/adding-a-license-to-a-repository/

4. REFERENCES.md which contains links and text of the resources you used to build your project. The format should be a “*” for each reference point.

Example of REFERENCES.md:

* https://stackoverflow.com

* I prompted ChatGPT to ask how do I open a GitHub issue”

Marking Scheme

20 Marks Total

●     Having correct APIs (will include test cases later on eclass and announce it). (6 Marks)

●    Auto-generated API documentation accessible from http://[ipv6 address]/docs (2 Marks)

○    The source of the OpenAPI docs is accessible from is http://[ipv6 address]/api- spec.yaml andis valid OpenAPI Spec (1 Mark)

●    Able to access Cybera server (3 Marks), if you haven’t deployed, we do not have anyway to access your cybera. Please include a screenshot of your cybera dashboard and instance.

●    Application is deployed on a web server such as Apache or Nginx (2 Marks)

●    Merge the pull request you created into your “main” branch with a phrase that closes the issue you created (1 Mark)

●    Using a unified naming convention for branch names and commits. (1 Mark)

●    Create a README.md in the main branch according to specifications (1 Mark)

●    Create a cybera.txt according to the specifications (1 Mark)

●    Create an MIT or Apache 2.0 license file according to these instructions:

https://help.github.com/articles/adding-a-license-to-a-repository/(1 Mark)

●    Create a REFERENCES.md according to the specifications (1 Mark)s

Important note: if you haven’t deployed we might need you to do a 3-5 minute demo of your assignment at the end of the labs, or based on a time that will be announced.

After releasing the scores, you will have 1 week to arrange a meeting with the TA to discuss your score. Academic Integrity

This is an individual assignment. Please do not share your work with your classmates. We may use a plagiarism detection system to check for plagiarism.

You may (and should!) use online tutorials, Stack Overflow posts and other publicly available resources.

You may (and should!) use AI tools like GitHub Copilot or Amazon CodeWhisperer. However, you should cite your sources in REFERENCES.md.

Frameworks to Consider

Here are some suggestions if you're unsure which framework to use.

● Django REST Framework(Python)

● FastAPI(Python)

● Flask RESTful(Python)

● Express(Node.js / JavaScript)

● Laravel(PHP)

● ASP.NET Web API(C#)

● Spring and Hibernate(Java)

● Rocket(Rust)

● Rails(Ruby)

● Gin(Golang)

DBMS to Consider

●    SQLite (SQL)

●    MySQL / MariaDB (SQL)

●    PostgreSQL (SQL)

●    MongoDB (NoSQL)


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp