60 sao GitHub và vẫn tăng — PostgREST/postgrest-heroku là dự án Shell mà TopGit đang theo dõi trên nền tảng. Restful API on Heroku
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
The best way to build an API, now for Heroku. Updated for PostgREST >= v9.0.0
Free and hobby Heroku PostgreSQL add-on do not support having multiple database roles (e.g. read-only or read-write roles).
Heroku Postgres paid tiers do
support multiple database roles, though you'll have to create them through
Heroku Postgres
Credentials as explained below.
To Deploy PostgREST on Heroku
Log into Heroku using the Heroku
CLI:
# If you have multiple Heroku accounts, use flag '--interactive' to switch between them
heroku login --interactive
Create a new Heroku app using this Heroku buildpack:
mkdir ${YOUR_APP_NAME}
cd ${YOUR_APP_NAME}
git init .
heroku apps:create ${YOUR_APP_NAME} --buildpack https://github.com/PostgREST/postgrest-heroku.git
heroku git:remote -a ${YOUR_APP_NAME}
Create a new Heroku Postgres add-on attached to the app and keep notes of the assigned add-on name (e.g. postgresql-curly-58902) referred later as ${HEROKU_PG_DB_NAME}
heroku addons:create heroku-postgresql:standard-0 -a ${YOUR_APP_NAME}
# wait until the add-on is available
heroku pg:wait -a ${YOUR_APP_NAME}
Create the necessary user roles according to the
PostgREST documentation:
heroku pg:credentials:create --name api_user -a ${YOUR_APP_NAME}
# use the following command to ensure the new credential state is active before attaching it
heroku pg:credentials -a ${YOUR_APP_NAME}
heroku addons:attach ${HEROKU_PG_DB_NAME} --credential api_user -a ${YOUR_APP_NAME}
Connect to the Postgres database and create some sample data:
heroku psql -a ${YOUR_APP_NAME}
# from the psql command prompt execute the following commands:
create schema api;
create table api.todos (
id serial primary key,
done boolean not null default false,
task text not null,
due timestamptz
);
insert into api.todos (task) values
('finish tutorial 0'), ('pat self on back');
grant usage on schema api to api_user;
grant select on api.todos to api_user;
PGRST_DB_URI can be set if an external database is used or if it's different from the default Heroku DATABASE_URL. This latter is used if nothing is provided.
POSTGREST_VER is mandatory to select and build the required PostgREST release.
See https://postgrest.org/en/stable/configuration.html#environment-variables for the full list of environment variables.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/PostgREST/postgrest-heroku là nguồn chính thức.
PostgREST/postgrest-heroku có phải mã nguồn mở không?
Có — PostgREST/postgrest-heroku phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/PostgREST/postgrest-heroku.
PostgREST/postgrest-heroku là gì?
PostgREST/postgrest-heroku (PostgREST/postgrest-heroku) là dự án Shell trên GitHub. Theo mô tả gốc: Restful API on Heroku
Đọc đầy đủ README ở tab phía trên.
postgrest-heroku có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về postgrest-heroku.