Introducci贸n a Node.js y Express
Node.js y Express
Entorno de trabajo
Variables de entorno
Rutas din谩micas
Body parser
Postman
CRUD
驴Que es una API Restful?
Solicitudes GET
Solicitudes POST
CRUD
Soluci贸n del reto de validaci贸n
Solicitudes DELETE
MIddlewares
Middlewares - logger
Middlewares - ErrorHandler
DB
Instalar Postgresql
Instalar Prisma y PostgreSQL Client
Prisma Models
JWT
Autenticaci贸n utilizando JSON Web Tokens (JWT)
Auth - Register
Auth - Login
Expres.js
Arquitectura
Arquitectura parte 2
Creaci贸n y Migraci贸n de Modelos con Prisma para Citas M茅dicas
Admin controllers / services
Admin controllers / services parte 2
Reservations
Reservations parte 2
Appointments
Deploy
PostgreSQL
Deploy
You don't have access to this class
Keep learning! Join and start boosting your career
Implementing a robust API in Express is a crucial step for any developer looking to create scalable and secure web applications. Deploying your API along with a cloud database allows you to have a fully functional system accessible from anywhere. This process, although technical, becomes simple when you follow the right steps and understand the fundamental concepts.
Once you have validated that your database is properly deployed and the connection is working properly, it is time to take your API into production. This process involves using cloud services that make it easy to deploy and manage web applications.
Before starting the deployment process, it is critical that you upload all your changes to a Git repository, either private or public. This step is crucial because:
To start the deployment, you must create a new resource on the selected platform (in this case, Railway) and connect it to your repository:
Environment variables are essential for keeping your application's sensitive data secure. During the deployment process, you must configure:
// Example of how these variables are used in the codeconst jwt = require('jsonwebtoken');const token = jwt.sign({ userId: user.id }, process.env.JWT_SECRET);
It is important that for the JWT_SECRET you use a complex phrase and not a simple word, as this increases the security of your authentication system.
Once you have configured the environment variables, you can proceed with the deployment:
This process may take a few minutes the first time, but subsequent deployments are usually faster. During the process, you can check the logs to identify possible errors or confirm that everything is working correctly.
Once your API is deployed, it is essential to verify that all endpoints are working correctly. For this, you can use tools such as Postman.
The first step is to update the URLs in your test requests:
localhost:5000
with the URL provided by the deployment service.// Before (local development)POST http://localhost:5000/api/auth/register
// After (production)POST https://tu-dominio-asignado.railway.app/api/auth/register
To verify that your authentication system is working properly:
Create a new user via the registration endpoint.
Test the login with the credentials of the created user
Verify in the database that the user has been created correctly
It is important to remember that passwords must be encrypted in the database, never in plain text.
Implementing a functional API is just the beginning. To take it to a professional level, you can face several challenges that will improve both your skills and the quality of your service.
An RFC is a proposal to improve or extend the functionality of your API. Some challenges you can address include:
Improving the medical appointment model:
Expand the role system:
Optimize error handling:
During the course you have learned fundamental concepts that you can continue to apply:
This knowledge allows you to build robust APIs for any type of application, from management systems to chatbots for WhatsApp.
Developing APIs with Express opens up a world of possibilities for creating modern and efficient web applications. Keep practicing, implementing new features and, above all, never stop learning.
Contributions 0
Questions 0
Want to see more contributions, questions and answers from the community?