This project is no longer active.
Tiny API - A Tiny API To Make Tiny APIs
- Quickly prototyping some front-end code and need a couple of endpoints to return some static JSON?
- Perhaps you're integrating a front-end with a back-end that doesn't have a test server?
- Maybe, you just want to see a website with a memorable user experience?
- Make an endpoint that returns static JSON in seconds with Tiny API
This repo is the server behind https://tiny-api.dev. The Tiny API Server is a REST API written in Go using Gin.
The code for the front end can be found here.
Tiny API is built on top of Postgres (I know, SQLite would have been tinier). You can quickly run a test database with docker using the following command.
docker run -d -p 5432:5432 \
--name tiny-api-postgres \
-e POSTGRES_USER=dev \
-e POSTGRES_PASSWORD=mysecretpassword \
-e POSTGRES_DB=tiny-api-dev \
postgres
Running the server requires the following environment variables to be set:
DB_CONNECTION=postgresql://dev:mysecretpassword@localhost:5432/tiny-api-dev?sslmode=disable
PORT=8080
GIN_ENV=development
CLIENT_URL=http://localhost:3000
To simplify things, create a .env
and then run:
export $(cat .env | xargs)
Running the tests will populate the test database with tables if they don't already exist. The tests can be run with:
go test
To run the server, run:
go run .
Allow only URL safe characters to be used for temp endpoints- Add an endpoint to check if a new temp endpoint already exists or not
- Remove (or at least comment out) endpoints that are unused
- Improve the directory structure (tests in particular)
Write a database script for bootstrapping the tables- Add an expiry for temp endpoints, and a helpful response message once those endpoints are hit after expiring