A REST API using Node.js and PostgreSQL with pg library and using Express.js for routing.
-
Node.js
-
PostgreSQL
-
Clone the repository:
git clone https://github.com/FaztWeb/postgresql-node-restapi.git
-
Install the dependencies:
npm install
-
Create a database in PostgreSQL
-
Create a .env file in the root directory and add the following:
DB_USER=your_username
DB_PASSWORD=your_password
DB_HOST=your_host
DB_PORT=your_port
DB_DATABASE=your_database
or just copy the .env.template file and fill it with your data.
- Run the server:
npm run dev
- GET /api/users
- GET /api/users/:id
- POST /api/users
- PUT /api/users/:id
- DELETE /api/users/:id
To run eslint: npm run lint
This project is open-sourced software licensed under the MIT License.