/ts_hacker_news

Node.js - Hacker News

Primary LanguageTypeScriptMIT LicenseMIT

Express Hacker News.

Considerations

Project setup

1 - Install dependencies

npm install

2 - Set environment variables

  • Clone the .env.example file and rename it to .env

  • Change environment variables

// important, it is only possible to start the background tasks (cron) through the environment variable, 
// if this function is not needed, keep the value false
ACTIVE_SCHEDULE_TASKS=true

3 - Start db container

docker-compose up -d

4 - Translate code to javascript (dist)

npm run build:clean

5 - Run db migrations

  • you must compile the application before using this command (step 4)
npm run migration:run

6 - Start the app

  • in reload mode with changes (option 1)
npm run dev
  • start the app with node (option 2)
npm run start

7 - populate the database (optional)

  • send a network request, to the endpoint ({domain_here}/articles/seed)
http://localhost:3000/articles/seed - GET

8 - Use postman documentation (optional)

select import in postman and select file located in (rootDir = repository base folder, In case of not modifying it, it would be ts_hacker_news)

rootDir/docs/express_hacker_news.postman_collection.json

Contributing

Run tests

  • verify correct installation by running the tests
npm run test
  • run tests in parallel
npm run test:parallel
  • checking coverage
npm run test:coverage

Code style

Eslint

  • check encoding rules
npm run lint

Prettier

  • just check code
npm run format:check
  • format code
npm run format:check