Public API
RESTful interface for fast accesing russian cities, districts and regions
Documentation is avaliable in Postman Documenter:
https://documenter.getpostman.com/view/5482678/SWLmWjBW?version=latest
If you can't access API through Postman, try to disable Self-signed SSL check in Settings -> SSL certificate verification
Request:
curl --location --request GET 'https://cities-api.ml/cities?name=Новгород'
Response:
[
{
"name": "Нижний Новгород",
"district_id": 7,
"region_id": 38,
"coordinates": "56.296504,43.936059",
"id": 1337
},
{
"name": "Великий Новгород",
"district_id": 3,
"region_id": 39,
"coordinates": "58.525570,31.274193",
"id": 1363
}
]
- Install dependencies
yarn
- Build app
yarn build
- Run server
yarn start
In app.js:
- Comment/delete lines below:
// import http from 'http';
// http.createServer(app).listen(serverPort, function() {
// console.log(`Express server listening on port ${serverPort}`);
// });
- Uncomment following lines
import https from 'https';
https.createServer(options, app).listen(serverPort, function() {
console.log(`Express server listening on port ${serverPort}`);
});
const options = {
key: fs.readFileSync(path.join(__dirname, './path/to/private.key', 'private.key')),
cert: fs.readFileSync(path.join(__dirname, './path/to/certificate.srt', 'certificate.srt')),
};
- Place your SSL certificates in
./path/to/private.key
and./path/to/certificate.srt