Coder Social home page Coder Social logo

todo_postgres's Introduction

Backend Todo App

This is a backend application for a Todo app built using Express.js, PostgreSQL, and Docker. It provides a REST API for managing todos.

Project Structure

The project has the following file structure:

  • src/app.js: Entry point of the application. Sets up the Express app and middleware.
  • src/controllers/todoController.js: Controller for handling todo-related requests.
  • src/services/todoService.js: Service for interacting with the database and performing CRUD operations on todos.
  • src/models/todoModel.js: Model representing the todo entity.
  • src/routes/todoRoutes.js: Routes for the todo API.
  • src/config/database.js: Configuration file for connecting to the PostgreSQL database.
  • Dockerfile: Dockerfile for building the Docker image.
  • package.json: Configuration file for npm.
  • README.md: Documentation for the project.

Usage

To run the application, follow these steps:

  1. Install the dependencies by running npm install.
  2. Set up the PostgreSQL database and update the src/config/database.js file with the appropriate credentials.
  3. Start the application by running npm start.

API Endpoints

The following API endpoints are available:

  • GET /todos: Retrieves all todos.
  • GET /todos/:id: Retrieves a specific todo by its ID.
  • POST /todos: Creates a new todo.
  • PUT /todos/:id: Updates an existing todo.
  • DELETE /todos/:id: Deletes a todo.

Docker

To build a Docker image for the application, use the provided Dockerfile. Run the following command in the project root directory:

docker build -t backend-todo-app .

This will build the Docker image with the tag backend-todo-app. You can then run the image using the following command:

docker run -p 3000:3000 backend-todo-app

This will start the application inside a Docker container and map port 3000 of the container to port 3000 of the host machine.

License

This project is licensed under the MIT License. See the LICENSE file for details.

todo_postgres's People

Contributors

trianhvo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.