[WP] 09.03.2023 | Node js API

 



fig 1.1 API-design-node.js-v4 course app flowchart I’ve done via lucid charts.



-----------------------------------------------------------------------
lucid chart url : https://lucid.app/lucidspark/2c182164-3fb8-448c-b955-0c82599bb337/edit?viewport_loc=-483%2C-134%2C6144%2C3074%2C0_0&invitationId=inv_a6b0d9db-2a17-49be-bd71-66a123b90732

---------------------------------------------------------------------

I made revision of API design course v4 from frontend masters. Code was written in node js with express js framework. Final app have server app listening on port 3001. Two unprotected routers to register(create new user) and sign in. All other routes defined within router with \api prefix. Router has protect middleware which ensures that user who is trying to communicate on /api/… routes holds valid token


Token is created for each user during registration. Jsonwebtoken library(JWT) provides means to combine user name, password and JWT_SECRET into unique token. Token is send in server response to signin POST request.


Course api is using postgresql database hosted via render.com. Each of cloud dbs have external URL string which can be used as DATABASE_URL environmental variable. Object relation model(ORM)- prisma is used to provide object oriented interface for relational SQL db. All data modeling is included within prisma.schema files. User may get access to current db records via studio interface – „npx prisma studio”.


Best regards

gmarcin


Komentarze

Popularne posty z tego bloga

[WP] 23.06.2023 | subjects

15.07.2024 | simplicity

[WP] 05.06.2023 | angular-intro