This API is part of a Docker stack. See the Epidemic-Escapes project.
To start the API without launching the complete stack, a MySQL database is needed.
To change the database see https://sequelize.org/docs/v6/getting-started/ for the sequelize drivers available. After installation change the dialect in src/models/index.js and config/config.js.
Create an .env file and add the following environment variables and fill accordingly with the database configuration. The rest of the configuration work as it is in development.
NODE_ENV="development"
API_PORT=3000
DB_SERVER=localhost
DB_DATABASE=bookstore
DB_USERNAME=bookstore
DB_PASSWORD=password
DB_PORT=3306
JWT_SECRET=d7a481461577ba4c3c4c6946cca7204b
JWT_EXPIRE=1d
JWT_ISSUER=epidemic-escapes
JWT_AUDIENCE=web-epimic-escapesStart the application in watch mode
npm run star:devRun the migrations
npm run migrate:upRoll back migrations
npm run migrate:undoRunning the seeds
npm run seed:allRoll back seeding
npm run seed:undoBuild the image.
docker build . -t alexandrelamberty/bookstore-api:tag Run the image with the default network and storage.
// FIXME: add storage reference from stack
docker run -p 3000:3000 --network=bookstore_default --mount source=media_data,target=/usr/src/app/public --env-file .env.dev --name bookstore-api -d alexandrelamberty/bookstore-api:tagPush image to DockerHub
docker push alexandrelamberty/bookstore-api:tag