This project I built login page using
- node.js,
- ejs,
- docker,
- docker compose
- railway
- vercel
- bootstrap
How I built this project is:
- I created ejs file which is file that is combined html and js, this file is used to show interface of the login page, I also used existing template bootstrap to help me designed the login page
- I Installed npm to built my node.js and installed my packages
- I created databasepg.js as a connector from postgresql to my login page
- I created server.js to built the endpoint and server for my login page
- CreateDB.sql is a file that will create table and insert first data to the table
- dockerfile to build ubuntu + apache and nodejs images
- docker-compose to handle multi container because I am using 4 container postgresql, pgadmin, apache, node.js
- Because postgre is on local, then I deploy my postgre in railway, and using connection string to connect my login page to railway postgres that I have deployed
- Then I created vercel.json as configuration to deploy my web in vercel.
- Finally, you can access my login page app through my vercel domain docker-login.vercel.app
After Created all needed files:
- Build apache images from dockerfile,
- After that command the apache command and uncommand nodejs to build node.js image
- pull postgre image and pgadmin image from pgadmin
- after that I already created docker-compose.yaml therefore you only need to run
docker-compose up
and the docker compose
This information to explain my endpoint:
- / to show login page where you can login or register on my login page
- /login this endpoint is the logic for login page, this will used query to read password from postgresql based on username that user input, and after that check if the password that user already input same as password in the database. If same then web will render success.ejs that is interface for login success.
- /register this endpoint will render register.ejs that is used to show register page where user can input username and password from that
- /signup this endpoint will used query to insert username and password into the database and render success.ejs after success to input new username and password to database