Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aed565b

Browse files
Update README.md
1 parent e805315 commit aed565b

File tree

1 file changed

+183
-0
lines changed

1 file changed

+183
-0
lines changed

‎README.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,186 @@ npm run start
4141
```
4242
#### Now server will run on localhost:3000. Make sure your system is not running other application on port 3000
4343

44+
## API Endpoints
45+
#### POST /upload/
46+
Send a POST request to http://localhost:3000/upload with a 'multipart/form-data' payload containing a field named csvFile that holds the CSV file <br/>
47+
Assuming you have a CSV file named data.csv, you can use curl bash command to send a POST request like this.
48+
```
49+
curl -X POST -F "csvFile=@data.csv" http://localhost:3000/upload
50+
```
51+
Replace data.csv with your CSV file name
52+
##### Demo responce
53+
```
54+
{
55+
"result": "200 events inserted into database...."
56+
}
57+
```
58+
#### GET /event/find?date=<YYYY-MM-DD>&latitude=<value>&longitude=<value>
59+
Send a GET request to fetch events data sorted by the earliest event after the specified date, with a page size of 10. Each event includes event name, city, date, weather, and the distance from the user's location <br/>
60+
Curl bash command to send a GET request like this.
61+
```
62+
curl -X GET "http://localhost:3000/event/find?date=2024年03月15日&latitude=40.7128&longitude=-74.0060"
63+
```
64+
##### Demo responce
65+
```
66+
{
67+
"events": [
68+
{
69+
"event_name": "Structure support choice",
70+
"city_name": "Fryland",
71+
"date": "2024年03月15日",
72+
"distance": "8910.23984646717",
73+
"weather": "Rainy 25C"
74+
},
75+
{
76+
"event_name": "Party development available",
77+
"city_name": "Port Alexander",
78+
"date": "2024年03月15日",
79+
"distance": "12710.135679990923",
80+
"weather": "Windy 27C"
81+
},
82+
{
83+
"event_name": "Of ask open",
84+
"city_name": "New Andrew",
85+
"date": "2024年03月16日",
86+
"distance": "15346.67040558074",
87+
"weather": "Rainy 3C"
88+
},
89+
{
90+
"event_name": "Air quickly home",
91+
"city_name": "Lawrenceview",
92+
"date": "2024年03月16日",
93+
"distance": "12674.554607967308",
94+
"weather": "Sunny 12C"
95+
},
96+
{
97+
"event_name": "Phone city",
98+
"city_name": "Riveraberg",
99+
"date": "2024年03月16日",
100+
"distance": "16078.58918887799",
101+
"weather": "Rainy 16C"
102+
},
103+
{
104+
"event_name": "Create success",
105+
"city_name": "New Susanmouth",
106+
"date": "2024年03月16日",
107+
"distance": "8301.79106018215",
108+
"weather": "Sunny 5C"
109+
},
110+
{
111+
"event_name": "Political check five",
112+
"city_name": "Lake Timothymouth",
113+
"date": "2024年03月17日",
114+
"distance": "14210.540682363635",
115+
"weather": "Snowy 12C"
116+
},
117+
{
118+
"event_name": "Glass although",
119+
"city_name": "Kathleenfort",
120+
"date": "2024年03月17日",
121+
"distance": "10573.065392070204",
122+
"weather": "Windy 1C"
123+
},
124+
{
125+
"event_name": "Assume by",
126+
"city_name": "East Brandyfort",
127+
"date": "2024年03月18日",
128+
"distance": "16561.73323780224",
129+
"weather": "Rainy -1C"
130+
},
131+
{
132+
"event_name": "Democrat seat nor",
133+
"city_name": "South Mark",
134+
"date": "2024年03月18日",
135+
"distance": "13743.417820685165",
136+
"weather": "Rainy 32C"
137+
}
138+
],
139+
"page": 1,
140+
"pageSize": 10,
141+
"totalEvents": 44,
142+
"totalPages": 5
143+
},
144+
{
145+
"events": [
146+
{
147+
"event_name": "Player",
148+
"city_name": "Lewischester",
149+
"date": "2024年03月19日",
150+
"distance": "15232.42376978484",
151+
"weather": "Cloudy 16C"
152+
},
153+
{
154+
"event_name": "May",
155+
"city_name": "New Brittany",
156+
"date": "2024年03月19日",
157+
"distance": "12064.028098110557",
158+
"weather": "Windy 10C"
159+
},
160+
{
161+
"event_name": "Involve describe",
162+
"city_name": "Port Jessica",
163+
"date": "2024年03月19日",
164+
"distance": "12599.10244010528",
165+
"weather": "Sunny 6C"
166+
},
167+
{
168+
"event_name": "Parent recognize",
169+
"city_name": "East Teresa",
170+
"date": "2024年03月19日",
171+
"distance": "14527.669322114876",
172+
"weather": "Rainy 27C"
173+
},
174+
{
175+
"event_name": "Discover environmental left",
176+
"city_name": "Jennifertown",
177+
"date": "2024年03月20日",
178+
"distance": "16949.357175041358",
179+
"weather": "Windy 26C"
180+
},
181+
{
182+
"event_name": "Build successful democratic article",
183+
"city_name": "South Misty",
184+
"date": "2024年03月20日",
185+
"distance": "10666.823058586891",
186+
"weather": "Cloudy 9C"
187+
},
188+
{
189+
"event_name": "Unit step remember",
190+
"city_name": "Scottfort",
191+
"date": "2024年03月21日",
192+
"distance": "11510.979200878548",
193+
"weather": "Rainy 0C"
194+
},
195+
{
196+
"event_name": "Support least recent",
197+
"city_name": "Carlville",
198+
"date": "2024年03月22日",
199+
"distance": "14788.096540228473",
200+
"weather": "Snowy 14C"
201+
},
202+
{
203+
"event_name": "School tax source",
204+
"city_name": "New Kelly",
205+
"date": "2024年03月22日",
206+
"distance": "14682.262928650607",
207+
"weather": "Sunny 6C"
208+
},
209+
{
210+
"event_name": "Take bill travel nearly",
211+
"city_name": "Melissaborough",
212+
"date": "2024年03月22日",
213+
"distance": "12108.74168258985",
214+
"weather": "Rainy 26C"
215+
}
216+
],
217+
"page": 2,
218+
"pageSize": 10,
219+
"totalEvents": 44,
220+
"totalPages": 5
221+
}
222+
```
223+
224+
225+
226+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /