Skip to content

bharathkumar-12/nuxt-latest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Nuxt.js Project with PostgreSQL Integration

Overview

This project is a Nuxt.js application that integrates with a PostgreSQL database. It demonstrates basic CRUD operations, user authentication, and how to containerize the project using Docker.

Table of Contents

Requirements

  • Docker and Docker Compose installed on your system.
  • Node.js and npm (for local development).

Setup

  1. Clone the repository:
    git clone <repository-url>
    cd <project-folder>
  2. Install dependencies:
    npm install
  3. Start the development server:
    npm run dev

Docker Image Creation

Step 1: Build Docker Image

To build a Docker image for the Nuxt.js application:

docker build -t <image_name>:<tag> .


Running the Docker Container

Step 1: Start the PostgreSQL Container
If not already running, start a PostgreSQL container:
docker run -d --name postgres_container \
  -e POSTGRES_USER=myuser \
  -e POSTGRES_PASSWORD=mysecretpassword \
  -e POSTGRES_DB=mydatabase \
  -p 5432:5432 \
  postgres

Step 2: Start the Nuxt.js Container
To start the Nuxt.js container:
docker run -d --name nuxt_app_container \
  -p 3000:3000 \
  --link postgres_container:postgres \
  -e DB_HOST=postgres \
  -e DB_USER=myuser \
  -e DB_PASSWORD=mysecretpassword \
  -e DB_NAME=mydatabase \
  <image_name>:<tag>

Step 3: Access the Application
Once the containers are running, you can access the application at:
http://localhost:3000
Interacting with the Application
Endpoints
GET /api/users: Retrieve all users.
GET /api/users?id=<user_id>: Retrieve a single user by ID.
POST /api/users: Create a new user. Requires name, email, and password.
PUT /api/users?id=<user_id>: Update an existing user by ID.
DELETE /api/users?id=<user_id>: Delete a user by ID.
POST /api/auth/login: User login.
POST /api/auth/register: User registration.



About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published