国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

代做 COMP33 Modern Technologies程序語言代做

時(shí)間:2023-12-02  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



COMP3**2 Modern Technologies on World Wide Web
Assignment Four
Total 12 points
Deadline: 23:59 December 3, 2023
Overview
Write an express.js program and name it index.js. This program provides the API to get data about
big cities from a MongoDB server.
Objectives
1. A learning activity to support ILO 1 and ILO 2.
2. To practice how to use Node, Express, MongoDB, and Mongoose to create a simple REST API.
Specification
Assume you are using the MongoDB server running on the course’s node.js docker container with
the service name mongodb listening to the default port 27017.
The database is named "bigcities" and it contains a collection called "cities". The collection consists
of 34800 cities with a population of at least 10000. The data for this dataset is sourced from the
GeoNames geographical database (https://www.geonames.org/about.html). Each record in the
collection consists of 9 fields: _id, Name, “ASCII Name”, “ISO Alpha-2”, “ISO Name EN”, Population,
Timezone, “Modification date”, and Coordinates.
_id Name ASCII Name ISO Alpha-2 ISO Name EN
The id of record
in Geonames
database
The name of the
city (in UTF8)
The name of
the city (in
ASCII)
The ISO 3166
Alpha-2 country
code
The English
name of the
Alpha-2 code
Example 1 3862981 Cañada de Gómez Canada de
Gomez
AR Argentina
Example 2 1819729 Hong Kong Hong Kong HK Hong Kong,
China
Population Timezone Modification
date
Coordinates
The population
of the city
The IANA timezone
ID
The date of
last
modification
The latitude and
longitude values
of the city
Example 1 36000 America/Argentina/
Cordoba
2020-06-10 -**.81636,
-61.39493
Example 2 7482500 Asia/Hong Kong 202**09-09 22.278**,
114.17469
Download the big cities dataset (bigcities.csv) from the course’s Moodle site. Import the data to the
bigcities database for the tests.
You will be using the provided framework for developing your program. You can download the
template file (template.txt) from the course’s Moodle site.
index.js
const express = require('express')
const app = express();
/* Implement the logic here */
// error handler
app.use(function(err, req, res, next) {
 res.status(err.status || 500);
 res.json({'error': err.message});
});
app.listen(3000, () => {
 console.log('Weather app listening on port 8000!')
});
TASK A
Use the command mongoimport to import the CSV file to the MongoDB server. Here are the steps to
import the data to your docker’s mongodb server.
1. Use Windows Explorer or Mac Finder to go to the data/db folder (which is inside the Nodedev folder).
2. Copy the bigcities.csv file there.
3. Access the docker desktop and open a terminal for the c33**2-mongo container.
4. In the terminal, type this command (in one line):
mongoimport -d=bigcities -c=cities --type=csv --headerline --columnsHaveTypes --file=bigcities.csv
Write the code to set up a connection to the MongoDB server using Mongoose.
Use the following schema to access the database.
Schema {
 Name: String,
 'ASCII Name': String,
 'ISO Alpha-2': String,
 'ISO Name EN': String,
 Population: Number,
 Timezone: String,
 'Modification date': String,
 Coordinates: String
}
Write the code that monitors the database connection and terminates the program if the connection
to the database is lost.
TASK B
Write a routing endpoint to handle all GET requests to the URL
http://localhost:3000/cities/v1/all?gte=xxxxx&lte=yyyyy
for retrieving the entire big cities dataset or a portion of the dataset based on the population range
defined in the query string. The server should respond with a JSON message and an appropriate
HTTP status code that reflects the completion status of the GET request to the client.
Situations:
1. GET /cities/v1/all
When the GET request is made without a query string,
the program retrieves the entire dataset from the
database. It then converts the Coordinates field to an
object with two properties: ‘lat’ and ‘lng’. These
properties represent the latitude and longitude values
(both of type Number) of the city. The program returns
the entire dataset in JSON format to the client with the
HTTP status code 200. The returned JSON message is an
array that contains all the documents, ordered by the _id
field.
2. GET /cities/v1/all?gte=xxxxx
GET /cites/v1/all?lte=yyyyy
GET /cities/v1/all?gte=xxxxx&lte=yyyyy
When the GET request includes a query string with the ‘gte’ and/or ‘lte’ parameters, the
program retrieves the dataset from the database based on the population range specified by the
query string. ‘gte’ stands for  and ‘lte’ stands for . For example, the program retrieves all cities
with a population  one million for the parameter gte=1000000. Another example, the program
retrieves all cities with a population between 500000  x  1000000 for the parameters
gte=500000&lte=1000000. After retrieving the dataset, the program should convert the
Coordinates field to an object and sort the dataset in descending order of population. The
program then returns the dataset in JSON format to the client with HTTP status code 200.
The program should return a JSON string '{"error":"No record for this population
range"}' with the HTTP status code 404 when it could not find any documents matching the
limit defined by the parameters, e.g., lte=1000&gte=10000.
3. When the program experiences an error (e.g., database issue), it returns the HTTP status code
500 with a JSON string '{"error":$message}', where $message stands for the error message
of that error event.
TASK C
Create a routing endpoint that handles all GET requests to the URLs
http://localhost:3000/cities/v1/alpha
http://localhost:3000/cities/v1/alpha/{code}
for retrieving all the alpha codes in the dataset or all the documents in the dataset that match a
specified alpha code in the URL path. The server should respond with a JSON message and the
appropriate HTTP status code to indicate the completion status of the GET request.
Situations:
1. /cities/v1/alpha
With this GET request, the program searches the database to find
all unique alpha-2 codes in the dataset. For each alpha-2 code, the
program creates an object with two properties: 'code' and 'name',
which contain the values from the ISO Alpha-2 and ISO Name EN
fields, respectively. The program then groups all alpha-2 code
objects into an array and sorts them in ascending order based on
the alpha-2 codes. Finally, the program returns this array object as
a JSON message to the client with a status code of 200.
2. /cities/v1/alpha/{code}
With this GET request, the program searches the database to
retrieve all documents that match the specified alpha code in the
path. For example, if the requested path is '/cities/v1/alpha/HK', the
program will find all documents with the 'HK' alpha-2 code. For each
matched document, the program retrieves the following fields:
“ASCII Name”, Population, Timezone, and Coordinates. It converts
the Coordinates field to an object and groups all matched
documents in descending order based on population. The program
then returns this array object as a JSON message to the client with
status code 200.
The program should return a JSON string ‘{“error”:”No record for this alpha code”}’
with the HTTP status code 404 when it could not find any documents matching the requested
alpha code.
3. When the program experiences an error (e.g., database issue), it returns the HTTP status code
500 with a JSON string ‘{“error”:$message}’, where $message stands for the error message
of that error event.
TASK D
Create a routing endpoint that handles all GET requests to the URLs
http://localhost:3000/cities/v1/region
http://localhost:3000/cities/v1/region/{region}
for retrieving all the regions in the dataset or all the documents in the dataset that match a specified
region in the URL path. In response, the server returns a JSON message and appropriate HTTP status
code to the client, which reflects the completion status of the GET request.
Situations:
1. /cities/v1/region
With this request, the program retrieves the Timezone field of all
documents and extracts the first component of the Timezone field to be
the region. For example, if the Timezone value is
"America/Argentina/Cordoba", the program will extract the region as
"America". The program then returns all unique regions in the dataset as a
JSON message to the client with the HTTP status code 200. The JSON
message lists all regions in alphabetical order.
2. /cities/v1/region/{region}
With this GET request, the program searches the database
to retrieve all documents that have the first component of
the Timezone field matches the specified region in the
URL path. For example, if the requested path is
'/cities/v1/region/Atlantic', the program will find 72
documents. For each matched document, the program
retrieves only the following fields: “ASCII Name”, “ISO
Alpha-2”, “ISO Name EN”, Population, Timezone, and
Coordinates. It converts the Coordinates field to an object
and groups all matched documents in descending order
based on population. The program then returns this array
object as a JSON message to the client with status code
200.
The program should return a JSON string ‘{“error”:”No record for this region”}’ with
the HTTP status code 404 when it could not find any documents matching the requested region.
3. When the program experiences an error (e.g., database issue), it returns the HTTP status code
500 with a JSON string ‘{“error”:$message}’, where $message stands for the error message
of that error event.
TASK E
Create a routing endpoint that handles all GET requests to the URL
http://localhost:3000/cities/v1/{city}?partial=true&alpha=xx&region=yyyy&sort=alpha|pop
ulation
for retrieving all the documents in the dataset that match the specified city in the URL path. In
response, the server returns a JSON message and appropriate HTTP status code to the client, which
reflects the completion status of the GET request.
Situations:
1. /cities/v1/{city}
With this GET request, the program retrieves all documents in the database that have the “ASCII
Name” field exactly matches with the specified city name in the URL path. For example, when
the city name is “Logan”, the program returns only one document; whereas for the city name
“Paris”, it returns 4 matched documents. For each matched document, the program retrieves
the following fields only: _id, “ASCII Name”, “ISO Alpha-2”, “ISO Name EN”, Population,
Timezone, and Coordinates. It converts the Coordinates field to an object and groups all
matched documents in ascending order based on the _id field. The program then returns this
array object as a JSON message to the client with status code 200.
2. /cities/v1/{city}?partial=true
When a query string is provided with the parameter
“partial=true”, the program finds all documents where the
“ASCII Name” field partially matches with the specified city
name in the URL path. For example, when the city name is
“Logan”, the program returns 6 matched documents that
have the string “Logan” in their “ASCII Name” fields. If the
parameter “partial” has a value other than “true”, the
program should ignore this parameter and apply the exactly
match as the searching criteria.
3. /cities/v1/{city}?alpha=xx
/cities/v1/{city}?region=yyyy
When the query string contains the “alpha” parameter, the
program restricts the search to documents under this alpha
code for the exactly or partially matched of the city name
(based on the partial parameter). For example, if a search is performed on the city name "Logan"
with partial=true and alpha=AU, only one matched city is found.
When the query string contains the “region” parameter, the program restricts the search to
documents under this region for the exactly or partially matched of the city name. For example,
when searching for the city name “Logan” with partial=true and region=America, five matched
cities are located.
If both the alpha and region parameters are provided, the program should ignore the region
parameter as the alpha parameter should have a higher priority.
4. /cities/v1/{city}?sort=alpha|population
If the sort parameter is not included, the default order will be based on the ascending order of
the _id field. If the sort parameter is included with the value “alpha”, all returned results will be
sorted in ascending order of the alpha code. If the sort parameter is included with the value
“population”, all returned results will be sorted in the descending order of population.
Otherwise, ignore other values and use the default order.
5. The program should return a JSON string ‘{“error”:”No record for this city name”}’
with the HTTP status code 404 when it could not find any documents matching the requested
city name with the parameters.
6. When the program experiences an error (e.g., database issue), it returns the HTTP status code
500 with a JSON string ‘{“error”:$message}’, where $message stands for the error message
of that error event.
TASK F
Write a routing endpoint to intercept all other request types and paths, which are not defined in
previous tasks. Return a JSON string with the HTTP status code 400. For example, for the request
POST /cities/v1/all HTTP/1.1, we get the response '{"error":"Cannot POST
/cities/v1/all"}'; for the request GET /cities/alpha/AU HTTP/1.1, we get the response
'{"error":"Cannot GET /cities/alpha/AU"}'.
Resources
You are provided with the following files.
• template.txt – the framework for the index.js file.
• bigcities.csv – the big cities data set.
Testing platform
We shall run the server program in the node-dev container set and use Curl and Firefox to test the
API.
Submission
Please finish this assignment before 23:59 December 3, 2023 Sunday. Submit the following files:
1. A JSON file – use mongoexport to export the whole collection from the bigcities database.
Similar to the mongoimport command, you have to open a terminal at the data/db folder
and type the following command (in one line):
mongoexport -d=bigcities -c=cities --jsonArray --sort='{_id: 1}' --out=3035111999.json
Replace 3035111999 with your student ID and upload this JSON file.
2. The complete index.js program and other required files.
3. The package.json file of your express program.
Grading Policy
Points Criteria
2.0 Task A
▪ Database set up, import the data set, and export the data set.
▪ The program can connect and access the MongoDB database.
▪ The program can detect that the database connection is broken.
2.5 Task B
▪ Correctly handle the GET request to return all big cities data
▪ Correctly handle the GET request with query string parameters to return the
specific set of data
▪ Error handling
2.0 Task C
▪ Correctly handle the GET request to retrieve all the alpha-2 code in the big cities
dataset.
▪ Correctly handle the GET request to retrieve all cities that have the matched
alpha-2 code.
▪ Error handling
2.0 Task D
▪ Correctly handle the GET request to retrieve all unique regions in the big cities
dataset.
▪ Correctly handle the GET request to retrieve all cities that have the matched
region.
▪ Error handling
2.5 Task E
▪ Correctly handle the GET request to retrieve all cities that have the matched city
name or partially matched city name.
▪ Correctly handle the GET request to retrieve all cities that have the matched city
name or partially matched city name within a specific region/alpha-2 code and
sorting order.
▪ Error handling
1.0 Task F
▪ Error handling of all unknown methods and paths
-4.0 Using any external libraries.
Plagiarism
Plagiarism is a very serious academic offence. Students should understand what constitutes
plagiarism, the consequences of committing an offence of plagiarism, and how to avoid it. Please
note that we may request you to explain to us how your program is functioning as well as we may
also make use of software tools to detect software plagiarism.
請(qǐng)加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:代寫CMPT 125、代做Computing Science
  • 下一篇:代做CMPUT 328、代寫VAE and Diffusion Models
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路流場(chǎng)仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真技術(shù)服務(wù)
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲勞振動(dòng)
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)40個(gè)行業(yè)
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)4
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手,多多出評(píng)軟件徽y1698861
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服務(wù)平臺(tái)
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內(nèi)
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗(yàn)證碼 寵物飼養(yǎng) 十大衛(wèi)浴品牌排行 suno 豆包網(wǎng)頁版入口 目錄網(wǎng) 排行網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號(hào)-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    久久久无码中文字幕久...| 国产精品免费区二区三区观看| 欧美一区二区激情| 五码日韩精品一区二区三区视频 | 国产欧美精品一区二区| 亚洲人成人77777线观看| 宅男av一区二区三区| 欧美激情一级精品国产| 蜜臀久久99精品久久久无需会员| 国产精品极品美女粉嫩高清在线| 国产精品入口福利| 久久艳片www.17c.com | 久久久精品视频成人| 久久久久久九九九| 久久精品国产精品亚洲| 久热精品视频在线| 欧美巨大黑人极品精男| 亚洲国产日韩综合一区| 丁香六月激情婷婷| 日韩精品不卡| 黄色av网址在线播放| 国产日韩中文在线| 99在线首页视频| 久草在在线视频| 国产精品视频专区| 九九久久久久久久久激情| 一区二区不卡在线| 日本久久久久久久| 蜜桃av久久久亚洲精品| 97国产精品免费视频| www.亚洲一区| 欧美激情一区二区三级高清视频 | 黄色一级大片免费| 国产在线播放一区二区| 成人动漫在线观看视频| 国产a级片免费看| 精品乱子伦一区二区三区| 亚洲精品无码久久久久久| 欧美综合77777色婷婷| 国产一区国产精品| 久久久久国产精品视频| 国产精品久久久亚洲| 亚洲一区二区免费在线| 欧美日韩国产综合在线| 成人久久一区二区三区| 国产suv精品一区二区三区88区| 久久久999国产精品| 一区二区三区久久网| 欧美午夜欧美| 99se婷婷在线视频观看| 国产精品美女网站| 日韩啊v在线| 国产精品一区二区三区在线| www国产亚洲精品久久网站| 一区二区三区av| 加勒比在线一区二区三区观看| 久久人人爽人人爽人人片av高请| 国产精品毛片va一区二区三区| 午夜久久久久久久久久久| 狠狠色综合欧美激情| 久久男人资源站| 色综合久久久久久中文网| 欧美日韩福利在线| 久久精品国产一区二区三区不卡| 欧美精品久久久久| 国产综合中文字幕| 久久久成人精品视频| 日韩最新中文字幕| 97人人干人人| 欧美激情网站在线观看| 国内精品久久久久久久果冻传媒| 国产成人a亚洲精品| 亚洲色欲综合一区二区三区| 国产男女猛烈无遮挡91| 国产精品久久av| 人妻少妇精品久久| 国产成人精品福利一区二区三区| 亚洲欧美成人一区| 国产精品一区二区在线观看| 国产精品久久久久久久乖乖| 日韩欧美视频免费在线观看| 91成人免费观看| 欧美激情日韩图片| 国产女人精品视频| 精品国产免费一区二区三区| 免费看国产精品一二区视频| 日韩中文娱乐网| 欧洲成人在线视频| 日韩中文字幕网址| 欧美日韩在线不卡一区| 色视频www在线播放国产成人| 午夜精品一区二区三区在线视频| 国产精品一区二区三区免费| 伊人网在线免费| 99在线观看视频免费| 午夜美女久久久久爽久久| 久久亚洲免费| 日韩精品一区二区三区丰满 | 国产精品18久久久久久麻辣 | 日韩av色在线| 久久久久久国产免费| 欧美亚洲午夜视频在线观看| 久久久久久中文字幕| 日韩毛片在线免费看| 日韩中文字幕不卡视频| 国内揄拍国内精品少妇国语| 精品中文字幕在线| 国产精品一区二区三区精品| 亚洲国产精品一区二区第四页av | 欧美xxxx黑人又粗又长精品| 国产精品一区二区免费在线观看| 一级一片免费播放| 久久久欧美精品| 欧美做暖暖视频| 国产精品日韩一区二区三区| 国产亚洲精品网站| 亚洲一区二区三区免费看| 国产激情999| 欧美精品成人一区二区在线观看| 精品久久蜜桃| 久久婷婷人人澡人人喊人人爽| 欧洲精品国产| 国产99视频精品免视看7| 国产成人一区二| 免费久久久一本精品久久区| 亚洲国产精品女人| 国产精品日韩欧美大师| www.日日操| 欧美亚州一区二区三区| 国产精品国产三级国产专区51 | av片在线免费| 欧美亚洲视频一区| 在线观看成人一级片| 久久爱av电影| 国产亚洲第一区| 日本www在线视频| 欧美日韩国产成人在线| 国产高清一区二区三区| 黄色网在线视频| 亚洲欧洲三级| 日韩视频永久免费观看| 91久久精品国产91性色| 男人天堂成人网| 亚洲a∨一区二区三区| 国产精品成人一区二区三区吃奶| 久久久天堂国产精品女人| 免费无遮挡无码永久视频| 亚洲a一级视频| 欧美日韩国产第一页| 久久久www成人免费精品| 久久综合久久综合这里只有精品| 国产天堂在线播放| 人妻内射一区二区在线视频| 一区二区在线观| 精品国产一区二区三区久久| 91.com在线| 粉嫩av一区二区三区天美传媒| 精品日产一区2区三区黄免费| 岛国视频一区| 亚洲伊人婷婷| 欧美精品亚州精品| 国产精品免费视频一区二区| 久久精品久久精品国产大片| 91精品啪在线观看麻豆免费| 国产另类第一区| 国产一级特黄a大片99| 精品欧美国产| 欧美日本韩国国产| 青青草国产精品| 亚洲高清精品中出| 亚洲一区二区精品在线| 国产精品国产三级国产专区51| 日韩最新在线视频| 久久久久久久999| 久久66热这里只有精品| 国产黄视频在线| 久久久在线观看| 91精品国产九九九久久久亚洲 | 国产一级片91| 欧美 国产 精品| 青青视频在线播放| 日韩精品在在线一区二区中文| 三级三级久久三级久久18| 性色av香蕉一区二区| 亚洲影院污污.| 亚洲精品中文字幕乱码三区不卡| 一区二区日本伦理| 亚洲中文字幕无码一区二区三区| 欧美精品久久久久久久久| 欧美激情一区二区久久久| 久久6免费高清热精品| 久久av红桃一区二区小说| 欧美激情喷水视频| 亚洲欧美日韩不卡一区二区三区 | 成人羞羞国产免费| 97久久超碰福利国产精品…| 国产精品av一区| 国产成人jvid在线播放| 久久久久久亚洲精品中文字幕| 久久久久免费精品|