Poke API
REST API utilizing the public PokéAPI
Setup
- Clone this repo
- Install the dependencies via
npm i
Running the API
Production
Compiled Typescript API into the dist
folder.
- Run
npm start
, this will start a nodejs server at: http://localhost:3000 by default.- You can alternatively pass a different port with the start script like:
PORT=3333 npm start
and it will start with the PORT environment variable passed in. In this example it would be3333
and starting the server at: http://localhost:3333
- You can alternatively pass a different port with the start script like:
- If you goto http://localhost:3000/ in your web browser you should see a response of
{"success":"true"}
Development with watcher
- Run
npm run dev
, and this will start nodemon for TypeScript. - It will start a nodejs server at: http://localhost:3000 by default.
- Any updates to the code will trigger a recompilation.
Development without watcher (or compile for production)
- Run
npm run build
, this will output the compiled TypeScript files into thedist
folder.
Run jest tests
- Run
npm run test
, in the current iteration, its expected that 1 out of 3 test fail (Mode is not tested/completed).
Documentation
- Included a
PokeAPI.postman_collection.json
, which can be imported to Postman for reference.
Notes
- Most recent version of
axios
has breaking errors in latest version. Had to debug and hardcode to version pin to 1.2.1.