Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fdaciuk/jaiminho
Rest application for zip codes from Brazil.
https://github.com/fdaciuk/jaiminho
Last synced: about 1 month ago
JSON representation
Rest application for zip codes from Brazil.
- Host: GitHub
- URL: https://github.com/fdaciuk/jaiminho
- Owner: fdaciuk
- Created: 2015-08-05T11:35:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-25T14:13:05.000Z (about 9 years ago)
- Last Synced: 2024-04-09T21:52:06.647Z (7 months ago)
- Language: JavaScript
- Size: 223 KB
- Stars: 16
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jaiminho
> Rest application for zip codes from Brazil.
![](assets/jaiminho.jpg)
## Dependencies
## Using Docker
If you want to use docker, just install it and run in this directory:
```sh
./jaiminho build
```After that, install NodeJS packages:
```sh
./jaiminho install
```And, after installation, run:
```sh
./jaiminho start
```To see all commands:
```sh
./jaiminho help
```To run in debug mode:
```sh
./jaiminho debug
```To run tests:
```sh
./jaiminho test
```To run a specific command:
```sh
./jaiminho run
```**Note:** If above commands don't work, you need to give execution permission for the `./jaiminho` file:
```sh
chmod +x ./jaiminho
```## Without using docker
You need to install `nodemon` and `istanbul` globally:
```sh
[sudo] npm i -g nodemon istanbul
```Now, you need to install project dependencies with command:
```sh
npm i
```## Running
Run jaiminho in debug mode with command:
```sh
npm run nodemon
```## Data model
jaiminho accepts the following fields:
- cep
- tipoDeLogradouro
- logradouro
- bairro
- cidade
- estado## Adding zip codes
```sh
curl -H "Content-Type: application/json" -X POST -d '{"cep":"76873274","tipoDeLogradouro":"Rua","logradouro":"Juriti","bairro":"Setor 02","cidade":"Ariquemes","estado":"RO"}' http://localhost:3000/cep
```**Response:**
```sh
'{"message":"76873274 succesfully inserted!"}'
```## Getting zip codes
```sh
curl -X GET http://localhost:3000/cep/76873274
```**Response:**
```sh
'{"cep":"76873274","tipoDeLogradouro":"Rua","logradouro":"Juriti","bairro":"Setor 02","cidade":"Ariquemes","estado":"RO"}'
```**Error response:**
```sh
'{"error":"CEP 76873274 not found"}'
```## Updating an existent zip code
```sh
curl -H "Content-Type: application/json" -X PUT -d '{"cep":"76873274","tipoDeLogradouro":"Rua","logradouro":"Juritingueta","bairro":"Setor 02","cidade":"Ariquemes","estado":"RO"}' http://localhost:3000/cep/76873274
```**Response:**
```sh
'{"message":"76873274 successfully updated!"}'
```## Deleting an existent zip code
```sh
curl -X DELETE http://localhost:3000/cep/76873274
```**Response:**
```sh
'{"message":"76873274 succesfully removed!"}'
```