Workshop Fastify 2019 - NodeConf 2019
Workshop steps
- Generate test project:
npx fastify-cli generate workshop - Add new route
/statusinside theservicesfolder - Test the new route inside
test/services - Create auth plugin using
fastify-basic-auth - Test auth plugin inside
test/plugins - Add new route
/methat will return the information of the user - Test route
/mewith two possible paths - Add new elastic search database:
- Install
fastify-elasticsearch - Setup your
app.jswith the Instructions in the Resources at the bottom
- Install
- Create a new route
/postthat will receive an object with the propertytextand create an object with the structure of:{id, user, topics, text, time, }and log it into Elastic Search. - Create test for
/post, sending the request and then checking if the record is in elastic search. - Create new route
/tweet/:idthat will return the information of a tweet given the id sent by parameters. - Add test
- Create the route
/timelinethat will return the latest tweets sort by time. - Add tracking with APM
- At the end they explained that you can easily create micro services of this monolith by creating n copies of the project and then leaving only a few routes on each project. This will give 3 projects running in different ports, therefore you can use
fastify-http-proxyto link all the different services into one. And also they provide a docker file that shows how to put everything in a container✨
Resources given in the workshop
- Workshop Repo
- Fastify Homepage
- Elastic Search instructions
- Kibana logs for the submitted tweets
- Kibana Traces
Last words
I think this has been an amazing workshop for various reasons:
- I've never worked with the framework so for me everything was new
😄 - The workshop was given by the maintainers of the framework
🔥 - It was a full demo using real services and technologies, not just a TODO app
😉 - All the steps were very clear and you can also check the documentation in case you are lost or anything
👌