GithubHelp home page GithubHelp logo

gthrm / cities-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 555 KB

RESTful interface for fast accessing russian cities, districts and regions

Home Page: https://cities-api.ml/cities

License: MIT License

JavaScript 100.00%

cities-api's Introduction

Russian cities API


Public API

RESTful interface for fast accesing russian cities, districts and regions

https://cities-api.ml/cities


Documentation

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


Example

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
    }
]

Deploy your own service

  1. Install dependencies
yarn
  1. Build app
yarn build
  1. Run server
yarn start

SSL changes for production deployment

In app.js:

  1. Comment/delete lines below:
// import http from 'http';
// http.createServer(app).listen(serverPort, function() {
//   console.log(`Express server listening on port ${serverPort}`);
// });
  1. 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')),
};
  1. Place your SSL certificates in ./path/to/private.key and ./path/to/certificate.srt

cities-api's People

Contributors

alveona avatar gthrm avatar

Watchers

 avatar  avatar

Forkers

alveona

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.