Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
tomit4 c947ae0069 :recycle: Refactored filtering by presence and duration 2 лет назад
..
db :construction: Continued filtering logic for initial survey answers 2 лет назад
lib :recycle: Refactored filtering by presence and duration 2 лет назад
server :gear: fixing knex config ssl bug 3 лет назад
tests :white_check_mark: Added test for user/validate session route 2 лет назад
.env.sample :construction: Updated env sample with new variables 2 лет назад
.eslintrc eslint switch case update to match prettier 3 лет назад
.nycrc :recycle: just cleaning up config stuff 5 лет назад
.prettierrc :gear: redoing prettier config | running prettier | adding some sample wave-ui elements 3 лет назад
README.md :memo: Updated readme with sql stmts for prod 2 лет назад
docker-compose.yml :recycle: integrating chat view into pairs and reworking pubnub 3 лет назад
knexfile.js :gear: making the knew config similar to the backend server config 3 лет назад
package-lock.json :recycle: Refactor with new Brevo API 2 лет назад
package.json :recycle: Refactor with new Brevo API 2 лет назад

README.md

siimee backend API

An API for the siimee application

:white_check_mark: Prerequisites

You will need…

Node.js 14+

:package: Installation

  1. Install dependencies with npm install
  2. Copy the environments sample file from ./backend/.env.sample and rename it to ./backend/.env
  3. Fill out your database connection details in ./backend/.env
  4. A test database container is provided and can be started with docker-compose up -d
  5. Populate some basic tables for your database using npm run generate && npm run reseed

:package: Installing Brevo

This note is added in case Brevo fails to install correctly, as it requires some extra configuration:

  1. Should brevo fail to work upon spinning up, ensure that brevo is installed:
npm install @getbrevo/brevo --save
  1. Then run ‘npm install’ again.
  2. Link the brevo package globally by running ‘npm link’.
  3. You’ll also need to link it directly within the backend directory (here):
npm link .

Transactional emails using the Brevo api should now be working.

:package: Migrations

We use Knex.js,which comes with a couple nice database migration and seeding tools. Migrating tracks changes in schema. Migration steps are contained in the ./db/migrations folder. Seeding adds dummy data once our database tables have been created and schemas are set. Starting seed steps are contained in ./db/seeds and use the mock.js file as the main dummy data source.

Migrating

  • Run npm run migrate to run all migrations and establish the base schema
  • Run npm run unmigrate to roll back one migration

Seeding

  • Run npm run generate to generate dummy data
  • Run npm run seed to seed the database with generated dummy data

Restarting

Since we can’t unseed the database, it’s best to destroy the dev database and rebuild it.

  1. Stop the database by navigating to the project root directory cd ../ and running docker-compose down
  2. Destroy the database volume docker volume rm siimee_siimee_db. BE CAREFUL.
  3. Restart the database while still at the project root with docker-compose up -d
  4. Recreate schemas,tables and dummy data by navigating to ./backend and running npm run reseed

:electric_plug: Run

  1. Run npm run start to start up the server
  2. Check http://localhost:3001/documentation to see the interactive API documentation

:robot: Deployment

TBD

:pill: Tests & Code Quality

Tests are run with AVA with code coverage reporting via nyc. Look at the example test for ideas, as well as the ava documentation

  • Run tests with coverage report with npm test

:heart: Built With

TRUNCATE TABLES IN PRODUCTION

users, responses, profiles, authentication TRUNCATE TABLE users; TRUNCATE TABLE responses; TRUNCATE TABLE profiles; TRUNCATE TABLE authentication;