diff --git a/README.md b/README.md index 64f4d73..21197c1 100644 --- a/README.md +++ b/README.md @@ -1,77 +1,52 @@ -![](https://heatbadger.now.sh/github/readme/contributte/api-skeleton/) +# API Skeleton -

- - - - -

-

- - - - - -

+Example native Nette API project using [contributte/api](https://github.com/contributte/api). -

-Website 🚀 contributte.org | Contact 👨🏻‍💻 f3l1x.io | Twitter 🐦 @contributte -

+## Requirements -

- -

+- PHP 8.4 or newer +- [Composer](https://getcomposer.org/) ------ +## Create the native Nette API -## Goal - -Main goal is to provide example of native API to [Nette](https://nette.org). - -## Demo - -https://examples.contributte.org/api-skeleton/ - -## Installation - -You will need `PHP 8.4+` and [Composer](https://getcomposer.org/). - -Create project using composer. +Create the distributed project, copy its local configuration, and prepare writable runtime directories: ```bash -composer create-project -s dev contributte/api-skeleton acme +composer create-project contributte/api-skeleton acme +cd acme +cp config/local.neon.example config/local.neon +mkdir -p var/tmp var/log +chmod 0777 var/tmp var/log ``` -Now you have application installed. It's time to run it. - -## Startup +The package distribution excludes the repository `Makefile`, so setup uses the direct commands above. Composer already installs dependencies during project creation. -The easiest way is to use php built-in web server. +## Run and verify the API ```bash -make dev -# php -S 0.0.0.0:8000 -t www +NETTE_DEBUG=1 NETTE_ENV=dev php -S 0.0.0.0:8000 -t www www/index.php ``` -Then visit [http://localhost:8000](http://localhost:8000) in your browser. +Passing `www/index.php` as the router lets the PHP development server handle API paths; the repository `make dev` target omits it. The server listens on . In another terminal, verify it: -**API endpoints** - -- http://localhost:8000/api/_/ping -- http://localhost:8000/api/_/apidoc -- http://localhost:8000/api/v1/product -- http://localhost:8000/api/v1/product/123456 - -## Development +```bash +curl http://localhost:8000/api/_/ping +# pong +``` -See [how to contribute](https://contributte.org/contributing.html) to this package. +## Discover the API contract -This package is currently maintaining by these authors. +Open to discover the available API routes and their request and response schemas. - - - +## Develop the repository checkout ------ +Repository contributors can use these Make targets; they are not included in projects installed from the package distribution: -Consider to [support](https://contributte.org/partners.html) **contributte** development team. Also thank you for using this project. +```bash +make qa # coding standard and static analysis +make tests # Nette Tester suite +make cs # coding standard check +make csf # fix coding standard issues +make phpstan # static analysis +make coverage # generate coverage output +```