Backend for application of rental movies and series
- Nodejs with express
- MySQL database
- Sequelize ORM
- Json Web Token
- CRUD of users, movies and series
- Log in as administrator to delete users or see all the content of the database
- See the logs of error, warning and info loggeds in the logs folder
Requires Node.js v16+ to run.
Install the dependencies and devDependencies and start the server.
npm install
Go to the .env.example file and rename it to .env and modify it with your settings
JWT_SECRET="add jtw secret"
SERVICE_PORT="add service port"
DB_USER="add database user"
DB_PSWD="add database password"
DB_HOSTNAME="add database hostname"
DB_PORT="add database port"
DB_NAME="add database name"
DB_DIALECT="add database dialect"
Create database and call it
rentalmovies
or throw
npx sequelize-cli db:create
Two ways:
Rename config/example.config.json to config.json and and modify it with your settings
{
"development": {
"username": "db username",
"password": "db password",
"database": "db database",
"host": "db host",
"dialect": "db dialect",
"port": "db port"
}
}
Launch the migrations
npx sequelize-cli db:migrate
or
Go to index.js and change sequelize.authenticate() to
sequelize.sync()
Remember to change it back if you want to keep the changes
If you want to have mocked data you can use
npx sequelize-cli db:seed:all
In the test folder you will find test files as a client
- auth.test.http
- movies.test.http
- series.test.http
- rentals.test.http
MIT
Fernando Valdivielso - @valdidev