Skip to content

Run your API out of the box, and consume it, simple, fast and easy.

License

Notifications You must be signed in to change notification settings

LaQuay/API-Out-of-the-box

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API-Out-of-the-box

Run your API out of the box, and consume it, simple, fast and easy.

Have you ever wanted to perform a proof of concept in which you needed backend software and frontend software? Or, have you ever seen the need to start a project but did not know where?

In this repository you will find code and information on how to start from almost-zero a project that has a backend, frontend, and an Android application!

What includes

Backend

  • Alpine 3.9
  • Python 3.7.2
  • Flask 1.0.2

Database

  • Alpine
  • Postgres 11.2
  • pgAdmin4.3

Frontend

  • Alpine
  • React 16.8
  • Node 8.15

Android application

Based in Android API 28 and with SDK minimum of API 19. It has Volley ready to be used, to call APIs.

Requirements

The software is meant to be run with Docker.

And, for the Android App, you need an IDE (e.g. Android Studio) and an Android Device.

Setup

Backend

Add your frontend URL in backend/source/resources_loader.py

Frontend

Add your backend URL in frontend/src/config.js

Run the project!

Run separately.

  • make setup
  • make run-backend
  • make run-frontend

And you will have running in:

  • PORT 3000: React - Frontend
  • PORT 5000: Flask REST API - Backend
  • PORT 5432: PostgresDB
  • PORT 5433: pgAdmin 4

Connect to pgAdmin 4

Open localhost:5433. The user and password are the ones that are shown in the docker-compose.yml.

To connect to the postgres database. Click in Add New Server and add the following information in the Connection tab:

Host name/address: postgres
Port: 5432
Maintenance database: postgres
Username: postgres
Role:
Service:

Default API call to the backend

POST :5000/entries/
Content-Type: application/json
{
    "value": "sample",
    "date": "2019-04-23 16:10:45"
}

And the response will be:

{
    "data": {
        "internal_id": 1
    },
    "error": null
}

Troubleshooting

Make run failed

Make sure the user has permission to run run.sh and that this file is in LF format.

docker run '...'
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"run.sh\": executable file not found in $PATH": unknown.
Makefile:27: recipe for target 'run-backend' failed
make: *** [run-backend] Error 127

Illegal option '-' in .sh

Make sure the user has permission to run configure-postgres.sh and that this file is in LF format.

About

Run your API out of the box, and consume it, simple, fast and easy.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published