{"id":17772696,"url":"https://github.com/jamesplease/api-pls-example","last_synced_at":"2026-03-19T01:59:14.987Z","repository":{"id":66133724,"uuid":"80963648","full_name":"jamesplease/api-pls-example","owner":"jamesplease","description":"An api-pls example project","archived":false,"fork":false,"pushed_at":"2017-02-22T01:20:00.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-01T03:45:52.103Z","etag":null,"topics":["api","json-api","rest-api"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesplease.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-05T02:35:20.000Z","updated_at":"2023-03-10T08:28:25.000Z","dependencies_parsed_at":"2023-04-12T10:38:15.209Z","dependency_job_id":null,"html_url":"https://github.com/jamesplease/api-pls-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jamesplease/api-pls-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesplease%2Fapi-pls-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesplease%2Fapi-pls-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesplease%2Fapi-pls-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesplease%2Fapi-pls-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesplease","download_url":"https://codeload.github.com/jamesplease/api-pls-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesplease%2Fapi-pls-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29396837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T04:26:15.637Z","status":"ssl_error","status_checked_at":"2026-02-13T04:16:29.732Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","json-api","rest-api"],"created_at":"2024-10-26T21:40:26.584Z","updated_at":"2026-02-13T04:38:11.510Z","avatar_url":"https://github.com/jamesplease.png","language":null,"readme":"# api-pls Example\n\nThis project demonstrates how to use [api-pls](https://github.com/jmeas/api-pls)\nto start up an API webserver in any project.\n\n#### Prerequisites\n\n- [Node.js](https://nodejs.org/en/) v7+\n- a [PostgreSQL database](#how-can-i-start-a-postgresql-database-to-run-this-example)\n\n### Getting Started\n\nClone this repository. Then, install the dependencies:\n\n```sh\nnpm install\n```\n\nNext, create a file in the root of this project called `.env`. Add the following\nline to the file, replacing the database URL with your own:\n\n```sh\nDATABASE_URL='postgres://user@example.com:5432/example'\n```\n\nNext, you'll need to create [Resource Models](https://github.com/jmeas/api-pls/wiki/Resource-Model).\nThese are the definitions that describe what tables and endpoints are created\nfor you.\n\nThere are several examples already created for you in the `./resources` directory:\nReview those, and make changes as you see fit.\n\nOnce you're satisfied with your resource models, run `npm run sync`. This\nwill generate migrations from your models, and then apply them to the database.\n\nYou're now ready to start the API webserver.\n\nRun `npm run start` to get it running. Once it's up, navigate your browser to\n`localhost:5000` to begin CRUD'ing.\n\n### FAQ\n\n#### How can I change my resource models after the initial migration?\n\nEventually, api-pls will allow you to change your resources dynamically. It does\nnot support this now, however. If you change your resource models, you'll need\nto clear all of the data in the database by running `npm run reset`.\n\nOnce that completes, you can run `npm run sync` to bootstrap the database\nwith your updated models.\n\n#### How can I start a PostgreSQL database to run this example?\n\nTo run the example, you'll need a PostgreSQL database URL. It is recommended\nthat you create a database specifically for testing purposes, rather than\nusing a database that you are using for other uses, too.\n\nMy preference is to create a free [Heroku](heroku.com) app, and then set up a\nfree version of\n[Heroku's PostgreSQL add-on](https://elements.heroku.com/addons/heroku-postgresql).\nThis provides you with 10,000 rows and 20 connections for free: more than enough\nthan what you'll need to try out the example.\n\nYou can also set up a database locally on your machine. This will differ\nslightly between operating systems. I recommend searching\n[StackOverflow](stackoverflow.com) for the best solution for your OS.\n\n#### My database does not use SSL; how can I connect to it?\n\nYou can set the \"ssl\" option to be `false` in your `.plsrc` file.\n\n```json\n{\n  \"resourcesDirectory\": \"./resources\",\n  \"ssl\": false\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesplease%2Fapi-pls-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesplease%2Fapi-pls-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesplease%2Fapi-pls-example/lists"}