Update deployed link and formatting

This commit is contained in:
rui hildt 2020-10-12 11:22:32 +02:00
parent 8ac6488675
commit a227f7f21b
5 changed files with 160 additions and 161 deletions

View File

@ -2,7 +2,7 @@
Find the the shortest path between different cities in Belgium with Dijkstra algorithm.
- Deployed Frontend: https://dijkstra.ruihildt.xyz/
- Deployed Backend: https://dijkstra-backend.herokuapp.com/
- Deployed Backend: https://dijkstra-backend.ruihildt.xyz/
- Frontend Source: https://git.ruihildt.xyz/ruihildt/dijkstra-frontend
@ -16,7 +16,7 @@ ___
| id | unsigned integer | primary key, auto-increments, generated by database |
| name | string | |
#### Get countries list
#### Get a list of all cities by country id
**`GET /api/countries/:country_id`**
##### Response
@ -49,7 +49,7 @@ An array of json objects with a list of cities in the selected country with `nam
| name | string | |
| country_id | unsigned integer | foreign key referencing `countries.id` |
#### Get cities list
#### Get a list of all cities
**`GET /api/cities`**
##### Response

Binary file not shown.

View File

@ -1,59 +1,58 @@
exports.seed = function(knex) {
return knex('cities').truncate()
exports.seed = function (knex) {
return knex('cities')
.truncate()
.then(function () {
return knex('cities').insert([
{
"id": 1,
"name": 'bruges',
"country_id": 1
},
{
"id": 2,
"name": 'antwerp',
"country_id": 1
},
{
"id": 3,
"name": 'ghent',
"country_id": 1
},
{
"id": 4,
"name": 'mechelen',
"country_id": 1
},
{
"id": 5,
"name": 'brussels',
"country_id": 1
},
{
"id": 6,
"name": 'mons',
"country_id": 1
},
{
"id": 7,
"name": 'namur',
"country_id": 1
},
{
"id": 8,
"name": 'liege',
"country_id": 1
},
{
"id": 9,
"name": 'arlon',
"country_id": 1
},
{
"id": 10,
"name": 'tournai',
"country_id": 1
},
{
id: 1,
name: 'bruges',
country_id: 1,
},
{
id: 2,
name: 'antwerp',
country_id: 1,
},
{
id: 3,
name: 'ghent',
country_id: 1,
},
{
id: 4,
name: 'mechelen',
country_id: 1,
},
{
id: 5,
name: 'brussels',
country_id: 1,
},
{
id: 6,
name: 'mons',
country_id: 1,
},
{
id: 7,
name: 'namur',
country_id: 1,
},
{
id: 8,
name: 'liege',
country_id: 1,
},
{
id: 9,
name: 'arlon',
country_id: 1,
},
{
id: 10,
name: 'tournai',
country_id: 1,
},
]);
});
});
};

View File

@ -1,92 +1,92 @@
exports.seed = function(knex) {
return knex('roads').truncate()
exports.seed = function (knex) {
return knex('roads')
.truncate()
.then(function () {
return knex('roads').insert([
{
"id": 1,
"start_city_id": 1,
"end_city_id": 3,
"distance": 50
},
{
"id": 2,
"start_city_id": 3,
"end_city_id": 10,
"distance": 80
},
{
"id": 3,
"start_city_id": 10,
"end_city_id": 5,
"distance": 89
},
{
"id": 4,
"start_city_id": 3,
"end_city_id": 5,
"distance": 56
},
{
"id": 5,
"start_city_id": 3,
"end_city_id": 2,
"distance": 60
},
{
"id": 6,
"start_city_id": 2,
"end_city_id": 4,
"distance": 25
},
{
"id": 7,
"start_city_id": 4,
"end_city_id": 5,
"distance": 27
},
{
"id": 8,
"start_city_id": 5,
"end_city_id": 6,
"distance": 80
},
{
"id": 9,
"start_city_id": 6,
"end_city_id": 7,
"distance": 91
},
{
"id": 10,
"start_city_id": 6,
"end_city_id": 10,
"distance": 51
},
{
"id": 11,
"start_city_id": 7,
"end_city_id": 9,
"distance": 129
},
{
"id": 12,
"start_city_id": 9,
"end_city_id": 7,
"distance": 123
},
{
"id": 13,
"start_city_id": 8,
"end_city_id": 7,
"distance": 65
},
{
"id": 14,
"start_city_id": 8,
"end_city_id": 5,
"distance": 97
}
id: 1,
start_city_id: 1,
end_city_id: 3,
distance: 40,
},
{
id: 2,
start_city_id: 3,
end_city_id: 10,
distance: 60,
},
{
id: 3,
start_city_id: 10,
end_city_id: 5,
distance: 70,
},
{
id: 4,
start_city_id: 3,
end_city_id: 5,
distance: 50,
},
{
id: 5,
start_city_id: 3,
end_city_id: 2,
distance: 50,
},
{
id: 6,
start_city_id: 2,
end_city_id: 4,
distance: 20,
},
{
id: 7,
start_city_id: 4,
end_city_id: 5,
distance: 20,
},
{
id: 8,
start_city_id: 5,
end_city_id: 6,
distance: 50,
},
{
id: 9,
start_city_id: 6,
end_city_id: 7,
distance: 60,
},
{
id: 10,
start_city_id: 6,
end_city_id: 10,
distance: 40,
},
{
id: 11,
start_city_id: 7,
end_city_id: 9,
distance: 110,
},
{
id: 12,
start_city_id: 9,
end_city_id: 7,
distance: 110,
},
{
id: 13,
start_city_id: 8,
end_city_id: 7,
distance: 50,
},
{
id: 14,
start_city_id: 8,
end_city_id: 5,
distance: 90,
},
]);
});
});
};

32
package-lock.json generated
View File

@ -763,9 +763,9 @@
"integrity": "sha512-ZjI4zqTaxveH2/tTlzS1wFp+7ncxNZaIEWYg3lzZRHkKf5zPT/MnEG6WL0BhHMJUabkh8GeU5NL5j+rEUCb7Ug=="
},
"dot-prop": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz",
"integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==",
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz",
"integrity": "sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==",
"dev": true,
"requires": {
"is-obj": "^1.0.0"
@ -1826,9 +1826,9 @@
}
},
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
},
"lowercase-keys": {
"version": "1.0.1",
@ -1946,9 +1946,9 @@
}
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"minipass": {
"version": "2.9.0",
@ -1987,11 +1987,11 @@
}
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "0.0.8"
"minimist": "^1.2.5"
}
},
"ms": {
@ -2471,9 +2471,9 @@
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
}
}
},