Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cybermaxi7/citiesapi
https://github.com/cybermaxi7/citiesapi
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/cybermaxi7/citiesapi
- Owner: Cybermaxi7
- Created: 2023-10-09T19:13:02.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-09T20:17:00.000Z (about 1 year ago)
- Last Synced: 2023-10-09T21:25:31.420Z (about 1 year ago)
- Language: JavaScript
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cities API
This is a minimal JSON API for managing city data using [JSON Server](https://github.com/typicode/json-server). It provides basic CRUD (Create, Read, Update, Delete) operations on city resources.
## Getting Started
These instructions will help you set up and run the API on your local machine.
### Prerequisites
Before you begin, ensure you have [Node.js](https://nodejs.org/) installed on your system.
### Installation
1. Clone the repository:
```bash
git clone https://github.com/cybermaxi7/cities-api.git
cd cities-api
```2. Install dependencies:
```bash
npm install
```3. Start the JSON Server:
```bash
npm start
```The API will be available at `http://localhost:7000`.
## API Endpoints
The API provides the following endpoints:
- **GET /cities**: Get a list of all cities.
- **GET /cities/:id**: Get details of a specific city by ID.
- **POST /cities**: Create a new city.
- **PUT /cities/:id**: Update an existing city by ID.
- **DELETE /cities/:id**: Delete a city by ID.### Example Usage
- Get a list of all cities:
```http
GET http://localhost:7000/cities
```- Create a new city:
```http
POST http://localhost:7000/cities
Content-Type: application/json{
"cityName": "New York",
"position": {
"lat": 40,
"lng": 0
},
"notes": "A great city!",
"emoji": "🗽"
}
```## Contributing
If you'd like to contribute to this project, please follow these guidelines:
- Fork the repository on GitHub.
- Create a new branch for your feature/improvement.
- Make your changes and commit them with clear messages.
- Push your changes to your fork.
- Submit a pull request to the main repository.## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.