My simple server web API written in NestJS framework. PostgreSQL database is used for data storage. Sequelize is used to interact with the database
NestJS |
PostgresSQL |
Sequelize |
Docker |
Copy repository
git clone https://github.com/Rowkash/blog-api.git
At the root of the repository, create a ".development.env" and ".production.env" files with the settings for connecting to the database and our JWT secret code. For example:
PORT=5000 # Port of our main app
POSTGRES_HOST=localhost # (use "postgres" when running a project using Docker)
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=root
POSTGRES_DB=blog
JWT_SECRET=secret
- For production we use the settings file " .production.env ", for development we use " .development.env "
- Install PostgreSQL on your computer from the official site
- Create server instance and database, add user and password as specified in .development.env file
- Make sure postgreSQL is up and running
- Open the project in the editor and install the dependencies
# yarn package manager
yarn install
yarn start ## (or "yarn start:dev" for development )
# npm package manager
npm install
npm run start ## (or "npm run start:dev" for development )
# pnpm package manager
pnpm install
pnpm run start ## (or "pnpm run start:dev" for development )
- Install Docker from the official site
- Run the command:
docker-compose up
# -d - to run in the background
# --build - to rebuild containers