
The npm init -y command will generate package.json file with the following contents: = request. Project Setupįirst step, create a project directory with name tutorial, then initialize Node.js using this command: mkdir tutorial You can use this structure to avoid confusion. In the end of this article, the structure of the project will be like this : tutorial Id | integer | | not null | nextval(’students_id_seq’::regclass) tutorial=# \d studentsĬolumn | Type | Collation | Nullable | Default To check the details of the table, use the command \d students. Use the command \dt to check if the table has been successfully created. Use the following command: tutorial=# CREATE TABLE public.students (ĬONSTRAINT students_pkey PRIMARY KEY (id) We will create a table named students in the public schema. Next, create a table in the tutorial database. Indicates that we have successfully connected to the tutorial database.

The prompt will change to the following: tutorial=# To use/connect to the tutorial database, use the command: postgres=# \c tutorial The above command is used to create a database with the name tutorial.
#BASIC POSTGRESQL TUTORIAL CODE#
postgres=#Ĭreating a Database To create a database, we use the command: postgres=# CREATE DATABASE tutorial To call a stored procedure, you use the CALL statement as follows: call storedprocedurename (argumentlist) Code language: SQL (Structured Query Language) (sql) For example, this statement invokes the transfer stored procedure to transfer 1,000 from Bob’s account to Alice’s account. Login using the command: psql -U postgresīy using the above command, we have logged in to PostgreSQL as the postgres user. Setting up the PostgreSQL Databaseįirstly, we will create a database in PostgreSQL that will be used by the service. Installation procedures can be found in the respective websites' documentation. Postman application (to hit the REST API Endpoint) READ - To retrieve/read existing data (GET)īefore following this article, there are several things that need to be installed first: These functionalities are for creating, reading, updating, and deleting data commonly referred to as CRUD.ĬRUD stands for Create, Read, Update, and Delete, which is actually an application of the data types in REST API. When creating a service, we want some basic functionalities to manipulate the resource. Which can be used to create a CRUD (Create, Read, Update, Delete) service/application. PUT - Modify the state or value of data or resource The following are some data types that REST API has: REST API is an API architectural style that uses the HTTP protocol to access and use data. Representational State Transfer (REST) contains standards for a web service. In web programming, APIs are used to access available data and services.

API or Application Program Interface serves as a communication facility between services or software.
