No description
- JavaScript 98.8%
- Shell 1.2%
| src | ||
| test | ||
| .babelrc | ||
| .gitignore | ||
| jsdoc.json | ||
| LICENSE | ||
| package.json | ||
| players.md | ||
| README.md | ||
| test-watch.sh | ||
| tournaments.md | ||
| wallaby.js | ||
| yarn.lock | ||
Beachvolleyball REST API
Usage (Clients)
Endpoints
Development
Database
To setup the project locally install Postgres and set PG_URL to your database. The format should postgres://USERNAME:PASSWORD@localhost/DB. The capitalized words should be replaced with your own values.
To export your variable on a Unix-system, simply use the export command, i.e. export PG_URL=your value.
Local production environment
Run npm run build to get a transpiled version of the API, then start with npm start.
Local development environment
If you're gonna develop:
- Install nodemon
npm install -g nodemon - Run
npm run start:devRemember that you can run it with environment variables in before the command, i.e.PG_URL=value npm run start:dev.
This will watch for changes and keep the application open for you.
Usage
- Create your models with Sequelize and place in
models/. Look at the example for inspiration. - Create a controller for the new entity by extending the common CRUD controller. See
controllers/example.controller.js - Create routes for the entity, see
routes/example.routes.js. - Rename the namespace in line 7 of
models/index.js
That's about it.
Tests
Single run
- Run unit tests & code lint with
npm test. This will use your local database. - Run just unit tests with
npm run testswithNODE_ENV=test. This will use your local database.
Watch
Run the unit tests continuously with npm run test:watch, only the tests currently worked on will run when updated.
All tests will run when a server file is updated. This will use your local database.
Credit
Thanks to essoen for a good boilerplate