Coder Social home page Coder Social logo

wonderakwei / restful-students-management-system-using-nodejs-and-postgresql Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 966 KB

In this project, I developed a RESTful API using NodeJS and PostgreSQL. The API provides functionalities to perform CRUD operations on student records.

JavaScript 100.00%
api crud-api crud-application database dotenv expressjs management-system nodejs postgres postgresql postman rest-api

restful-students-management-system-using-nodejs-and-postgresql's Introduction


NodeJS + PostgreSQL RESTful API Project


Project Overview:

This project showcases the development of a RESTful API built with NodeJS and PostgreSQL, focusing on CRUD operations for student records.


Setup and Execution:

1. Prerequisites:

  • Ensure that NodeJS and PostgreSQL are installed on your system.
  • Install Postman or a similar tool for testing the API endpoints.

2. Installation:

NodeJS Dependencies:

Navigate to the project directory and install the required NodeJS packages using npm:

npm install

Framework Used:

The project utilizes Express.js as the web framework for developing the RESTful API: To install Express.js, navigate to your project directory and run:

npm install express

PostgreSQL Configuration:

  • Create a PostgreSQL database named studentsdb.
  • Configure the database connection details in the .env file as follows:
    DB_HOST=localhost
    DB_PORT=5432
    DB_USER=your_username
    DB_PASSWORD=your_password
    DB_NAME=studentsdb
    

3. Running the Application:

Launch the NodeJS application with the following command:

node server.js

The application will initialize on the default port 3000, unless otherwise specified in the .env file.

4. Testing the API:

Utilize Postman to interact with the API endpoints:

  • Create Student: Submit a POST request to http://localhost:3000/students with the student details in the request body.
  • Retrieve Students: Issue a GET request to http://localhost:3000/students to fetch all students, or http://localhost:3000/students/:id for a specific student by ID.
  • Update Student: Dispatch a PUT request to http://localhost:3000/students/:id containing the updated student details in the request body.
  • Delete Student: Dispatch a DELETE request to http://localhost:3000/students/:id to remove a student based on their ID.

API Endpoints:

  • GET /api/v1/students: Fetch all students.
  • GET /api/v1/students/:id: Retrieve a student by ID.
  • POST /api/v1/students: Add a new student.
  • PUT /api/v1/students/:id: Modify a student by ID.
  • DELETE /api/v1/students/:id: Remove a student by ID.

Contributing:

We welcome pull requests. For significant changes, kindly initiate an issue to discuss potential modifications or enhancements.


restful-students-management-system-using-nodejs-and-postgresql's People

Contributors

wonderakwei 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.