The Grind API Template is an example project for building API’s on Grind. It’s also used as a template in Grind Toolkit so you can quickly setup a new API project.
git clone https://github.com/grindjs/example-api.git grind-example-api
cd grind-example-api
yarn install
yarn cli migrate:latest
yarn cli db:seed
# Use `watch` to automatically restart the server on file changes
# Watch is recommended for development
yarn cli watch
# Use `serve --cluster` to launch a cluster of workers
# Cluster is recommended for production
yarn cli serve --cluster
# Use `serve` to launch a single worker
yarn cli serve
You should now be able to visit localhost:3000/states.
Other URLs:
- Paged: localhost:3000/states?limit=10
- Individual: localhost:3000/states/ny
- Search: localhost:3000/states/search?term=new
- Swagger: petstore.swagger.io/?url=http://localhost:3000/swagger.json
Full documentation for Grind is available on the Grind website.
Grind was created by Shaun Harrison and is made available under the MIT license.