RESTful API with Node.js, Express, and Postgres
Create, read, update, delete in a Node.js app with an Express server and Postgres database.
Read the tutorial
Database
brew install postgresql
brew services start postgresql
psql postgresCREATE ROLE me WITH LOGIN PASSWORD 'password';
ALTER ROLE me CREATEDB;
CREATE DATABASE api;
GRANT ALL PRIVILEGES ON DATABASE api TO me;psql -d api -U meCREATE TABLE users (
ID SERIAL PRIMARY KEY,
name VARCHAR(30),
email VARCHAR(30)
);
INSERT INTO users (name, email)
VALUES ('Jerry', 'jerry@example.com'), ('George', 'george@example.com');Installation
git clone git@github.com:taniarascia/node-api-postgres
cd node-api-postgres
npm install
node index.jsCommands
- GET:
curl http://localhost:3000/users - POST:
curl --data "name=Jerry&email=jerry@example.com" http://localhost:3000/users - PUT:
curl -X PUT -d "name=George" -d "email=george@example.com" http://localhost:3000/users/1 - DELETE:
curl -X "DELETE" http://localhost:3000/users/1
Author
License
This project is open source and available under the MIT License.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
