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

Binary file not shown.

View File

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

View File

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

32
package-lock.json generated
View File

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