一覧へ戻る
taniarascia/node-api-postgres(新しいタブで開きます)
主要言語: JavaScript
RESTful API with Node.js, Express, and Postgres.
- star 数
- 103
- watcher 数
- 2
- fork 数
- 53
- issue 数
- 3
- 最終更新
- 2022/03/30
主要言語: JavaScript
RESTful API with Node.js, Express, and Postgres.
Create, read, update, delete in a Node.js app with an Express server and Postgres database.
brew install postgresql brew services start postgresql psql postgres
CREATE 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 me
CREATE 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');
git clone git@github.com:taniarascia/node-api-postgres
cd node-api-postgres
npm install
node index.jscurl http://localhost:3000/userscurl --data "name=Jerry&email=jerry@example.com" http://localhost:3000/userscurl -X PUT -d "name=George" -d "email=george@example.com" http://localhost:3000/users/1curl -X "DELETE" http://localhost:3000/users/1This project is open source and available under the MIT License.