https://github.com/hexlet-components/js-fastify-blog
https://github.com/hexlet-components/js-fastify-blog
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hexlet-components/js-fastify-blog
- Owner: hexlet-components
- Created: 2021-07-16T18:45:50.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-02T09:28:06.000Z (about 2 years ago)
- Last Synced: 2024-05-02T22:16:47.980Z (about 2 years ago)
- Language: JavaScript
- Homepage: https://js-fastify-blog.hexlet.app
- Size: 628 KB
- Stars: 2
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JS Fastify Blog
[](https://github.com/hexlet-components/js-fastify-blog/actions/workflows/main.yml)
## Requirement
* NodeJS v20.6.1
* Sqlite или PostgreSQL
## Commands
```bash
make install
make dev
```
## Run tests with Postgres
To run tests with Postgres, you need to edit *config/config.cjs* and under the `test` key comment out the use of SQLite and uncomment the environment variables
```js
// test: {
// dialect: 'sqlite',
// storage: './database.test.sqlite',
// },
test: {
dialect: 'postgres',
database: process.env.DATABASE_NAME,
username: process.env.DATABASE_USERNAME,
password: process.env.DATABASE_PASSWORD,
port: process.env.DATABASE_PORT,
host: process.env.DATABASE_HOST,
},
```
Specify environment variables manually or prepare a *.env* file with the command
```bash
make prepare-env
```
In it specify the data to connect to the database
```dotenv
DATABASE_NAME=postgres
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=postgres
DATABASE_PORT=5432
DATABASE_HOST=localhost
```
## Running an application with Postgres (production)
Export environment variables to work with the database or prepare a *.env* file with variables
Run
```bash
make build # build assets
make start # Open in browser: http://localhost:8080
```
---
[](https://hexlet.io?utm_source=github&utm_medium=link&utm_campaign=js-fastify-blog)
This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io?utm_source=github&utm_medium=link&utm_campaign=js-fastify-blog).
See most active contributors on [hexlet-friends](https://friends.hexlet.io/).