|
|
пре 5 година | |
|---|---|---|
| .. | ||
| db | пре 5 година | |
| lib | пре 5 година | |
| server | пре 5 година | |
| tests | пре 5 година | |
| .eslintrc | пре 5 година | |
| .nycrc | пре 5 година | |
| .prettierrc | пре 5 година | |
| README.md | пре 5 година | |
| knexfile.js | пре 5 година | |
| package-lock.json | пре 5 година | |
| package.json | пре 5 година | |
An API for the siimee application
You will need…
brew install node using Homebrewapt install nodejs (see Ubuntu/Debian specific instructions) or pacman -S nodejs (Arch Linux)npm install./server/.env.sample and rename it to ./server/.env./server/.envdocker-compose --env-file ./backend/server/.env up -dnpx knex migrate:latestWe 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.
npm run migrate to run all migrations and establish the base schemanpm run unmigrate to roll back one migrationnpm run seed to seed the database with dummy dataSince we can’t unseed the database, it’s best to destroy the dev database and rebuild it.
cd ../ and running docker-compose downdocker volume rm siimee_siimee_db. BE CAREFUL.docker-compose --env-file ./backend/server/.env up -d./backend and running npm run migratenpm run seednpm run start to start up the serverTBD
Tests are run with AVA with code coverage reporting via nyc. Look at the example test for ideas, as well as the ava documentation
npm test