Socket
Book a DemoInstallSign in
Socket

api-pls

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-pls

Effortless JSON API-compliant APIs

0.7.0
Source
npmnpm
Version published
Weekly downloads
20
66.67%
Maintainers
1
Weekly downloads
 
Created
Source

api-pls

Travis build status

api-pls enables you to effortlessly create JSON API-compliant APIs.

Note: this project is a work in progress. It currently functions in a limited manner.

Motivation

It can be time-consuming to put together an application with a robust backend. Use api-pls to speed up that process considerably.

Instead of writing database and API code within your project, simply define models, and let this tool do the rest.

api-pls will:

✓ Configure a database for you
✓ Set up a web server that adheres to JSON API for interactions with those resources
Create and run migrations for you when you change your resource models

This project is a work in progress. Resource migrations beyond the initial set up are currently unsupported.

Technologies Used

Currently, the only supported database is PostgreSQL. The webserver is written in Node.js using Express.

Getting Started

Try out the example project to see api-pls in action.

Installation

Install the api-pls CLI.

npm install api-pls --global

Next, create a file in the root of your project called .env. Add the following line to the file, replacing the database URL with your own:

DATABASE_URL='postgres://user@example.com:5432/example'

Note: It is required that your database has SSL enabled.

Next, you'll need to create resource models. These are the definitions that describe what tables and endpoints are created for you. Place your resource models in the directory ./resources.

More complete documentation for the resource model files is coming soon; for now, refer to the example project.

Once you've defined your resources, run pls migrate. This will generate database migrations from your resource models, and then run those migrations.

You're now ready to start an API webserver. Run pls start to start the server.

You can access the API webserver at localhost:5000.

Anytime you make changes to your resource models, be sure to run pls reset-database to clear out all of the previous models. Presently, only the initial migrations are supported.

Acknowledgements

Many thanks goes to Tyler Kellen for his work on Endpoints (which inspired me to write this) and for our many conversations about REST.

Keywords

json-api

FAQs

Package last updated on 05 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.