Skip to content

API made by me and with some random stuffs to learn and practice about Node's concepts, practices, frameworks and packages.

Notifications You must be signed in to change notification settings

RafaelEmery/nodejs-api-studies

Repository files navigation

📗 My Personal Node.js API studies

The ideia is to study and practice about Javascript applications and Node's REST APIs.

The structure of src directory (Old image):

💡 Techs and Packages

🏃 Run the API

Installing all the packages

npm install

Running on http://localhost:3000

npm start

🔧 Random and Cool Features

Here are some features made to apply my personal studies.

Migrations and Seeds with Knex.js

Migrations and Seeds for products and users using Knex.js Query Builder and PostgreSQL. I applied mostly random types and OneToMany relationship at the database.

🎁 You can access the files at the database directory and see the configs at knexfile.js.

Update timestamp trigger

Raw SQL procedure and trigger to update the timestamp updated_at in the database products and users. Just read the comments at the database files and knexfile.js.

Request's validations using Celebrate

To validate the requests made with Postman was used the Celebrate package which is basically a middleware using Joi. Very simple! You can find it at routes.

Sending Emails with NodeMailer

I used the NodeMailer package along the Ethereal Service to test some fake emails.

Authentication and authorization using JWT

JSON Web Token (JWT) to autenticate and authorize users. To apply in the Controllers was made a middleware for autorize the user.

🎁 If you want to see all the auth stuffs, you'll have to seach for the "auth" files.

TDD with Jest

Usage of Jest package for unit testing at test directory. So far, my tests are a little bit simple and for the utils functions on src/utils directory.

❓ to run the tests

npm test

Uploading file with express-fileupload

Using the express-fileupload package to upload a single file (so far). Take a look at the FileController.js and the post route at the index.js at routes directory.

(Not done yet) Consuming APIs using Axios

Using the Axios package to consume my personal Fake Data API

Made with ♥️ by Rafael Emery

About

API made by me and with some random stuffs to learn and practice about Node's concepts, practices, frameworks and packages.

Topics

Resources

Stars

Watchers

Forks