Skip to content

code08-ind/Url-Shortener-Nodejs

Repository files navigation

URL Shortener

Tech Stack

Backend: Node.js+Express Database: Postgresql ORM: Drizzle Containerization: Docker+Compose Authentication: JWT Testing Tool: Postman

NPM Dependencies

npm install express drizzle-orm pg jsonwebtoken bcrypt dotenv

npm i @types/node @types/express@4.x -D

Auth Routes

Method Endpoint Description Auth Required
POST /signup Register a new user
POST /login Login and receive token

URL Routes

Method Endpoint Description Auth Required
POST /shorten Create a short URL from a long one
GET /:shortCode Redirect to the original URL
GET /urls Get all URLs created by the logged-in user
DELETE /urls/:id Delete a short URL (if it belongs to user)

We have already established the docker-compose.yml, now if we are having the docker hub, we can run the same here on it using:

bash ``` docker compose up -d


Now after this setup, we will setup the postgres in drizzle:

bash ```
npm db:studio

In a new terminal, we will push the changes in DB using:

bash ``` npm db:push


After creating schema, we need to push the schema:

bash ```
npm db:push

About

A URL Shortener Build Using Node JS Backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published