Skip to content

Instantly share code, notes, and snippets.

@UltiRequiem
Last active October 14, 2021 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UltiRequiem/bdf642f89c05534381e7a77bdba52aa7 to your computer and use it in GitHub Desktop.
Save UltiRequiem/bdf642f89c05534381e7a77bdba52aa7 to your computer and use it in GitHub Desktop.

Nodemon

JavaScript Style Guide

A Pokemon API built with Hapi on Node.js.

Deploy

Download and Install Node.js.

Get the code:

git clone https://github.com/eliasbobadilla/nodemon.git && cd nodemon

Run:

npm install && npm start

Endpoints

  • Display all Pokemons
curl http://localhost:3000/v1
  • Paginate
curl http://localhost:3000/v1/paged/?page=1&limit=4
  • Search Pokemon by Name
curl http://localhost:3000/v1/?name=charizard
  • Add Pokemon
curl -X POST http://localhost:3000/v1/upsert \
   -H 'Content-Type: application/json' \
   -d '{
  "number": 1000,
  "name": "Mega Metapod Test",
  "type1": "Bug",
  "total": 1000,
  "hp": 1000,
  "attack": 1000,
  "defense": 1000,
  "spAtk": 1000,
  "spDef": 1000,
  "speed": 1000,
  "generation": 1,
  "legendary": false
}'
  • Delete Pokemon
curl -X DELETE http://localhost:3000/v1/?id=7

License

This program is licensed under the MIT License.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment