Skip to content

phoelapyae/url-shortener-backend

Repository files navigation

Shortener App using SLAP Architecture

A REST API built with Node.js and TypeScript to generate a shorter url of a logn url.

Prerequisites

  • Node.js >= 20

Installation

  1. Clone the repository:
git clone <repository-url>
cd url-shortener-backend
  1. Install dependencies:
npm install
  1. Configure environment variables:
cp .env.example .env
  1. Update .env with your credentials
DATABASE_URL=postgres://<postgres-username>:<postgres-password>@localhost:5432/shortener
PORT=8000
HOST=http://localhost:8000
  1. Testing the application
npm run test
  1. Seed the database:
npm run db:seed
  1. Start the development server:
npm run dev

The api server will run at http://localhost:8000

API Endpoints

  • GET /api/shorteners - List all the urls
  • POST /api/shorteners - Generate a new short url
  • DELETE /api/shorteners/:id - Delete a url
  • GET /api/:short_url - Redirect to full url

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published