NodeJS API-Part 4 / Headers middleware

Soon Sam Santos
Jan 17, 2021

This is the 4º tutorial of a complete series of building a production NodeJS API using Express, MySQL and Sequelize”.

Full source code of this class is available at GitHub Martial Arts API Part 4

This particular class is thanks to Academind Building a Restful API with NodeJS. Awesome teacher! :)

Photo by Joshua Ness on Unsplash

ADDING HEADER MIDDLEWARE

Another thing that will be great in our project is to add some configuration headers to our application. To do so, we need to add it using express middleware, otherwise, we would need to add the same headers to every single request.

CONCLUSION

If you want to go deeper on this subject I recommend you to watch Parsing the Body & Handling CORS | Creating a REST API with Node.js.

Full source code of this class is available at GitHub Martial Arts API Part 4

--

--

Soon Sam Santos

Flutter and Delphi Developer at Green. Teacher at SoonClass