REST Api training, I build a simple crud for architecting an effective and efficient API using fastify, it will achieve Speed, documentation using swagger and create the architecture and sustainability of the code base.
user@machine ~$ git clone https://github.com/h3ct0rjs/fastify-potter-api fastify_potter
user@machine ~$ cd fastify_potter
user@machine ~/fastify_potter/src$ cd src
user@machine ~/fastify_potter/src$ npm install
you will need to seed the database using the populatedb.js
script available in the data folder
user@machine ~/fastify_potter/src$node ./data/populatedb.js
then run in development mode :
user@machine ~/fastify_potter/src$ npm run dev
you should be able to reach the api in http://localhost:9000/api/
check if this is it with the information
endpoint http://localhost:9000/api/info
All the information is availible in http://localhost:9000/api/docs
generated by the
swagger fastify plugin.
- Create api benchmarks.
- CI/CD Integration.
- Add unit testing with mocha.
- Add more data about the potter verse.
This was a quick and fast exercise to practice the Architecture and Sustainability of a rest API, there are multiple improvements that could be done. You can use this code to learn patterns or think in improvements.
MIT