In this REST API, users can create a new account, sign in or enter as a visitor. Users can create a post on a wall if they are logged, or just read the posts, if they aren't. This API was built using NodeJs, ExpressJs, MySQL and Sequelize.
To run this application, open the terminal in any directory of your choice and run the commands below:
- Clone the project
git clone git@github.com:gabriellukke/wall-app-backend.git
- Enter in project directory
cd wall-app-backend
- Install project dependencies
npm install
or
yarn install
- To run this API properly you need to set this properties in a
.env
file at project root directory:
DB_USER=[Your database username]
DB_PASSWORD=[Your database password]
DB_NAME=[Your database name, ex: wall, wall_test ]
DB_HOSTNAME=[Host used by MySQL]
NODE_ENV=[The environment you wanna use: development || test || production]
JWT_SECRET=[Secret used to hash the user passoword]
NODEMAILER_EMAIL=[Email used by nodemailer]
NODEMAILER_PASSWORD=[Email password used by nodemailer]
PORT=[The port at localhost you wanna use]
Once you've installed the dependencies and set the environment variables correctly you can follow the commands in your terminal:
npm start
or
yarn start
This project uses Mocha, Chai, Sinon and SuperTest for testing.
- The unit tests are isolated from the database in this project, so you can run without database connection.
Running tests on terminal:
npm run test:unit
or
yarn run test:unit
Running integration tests:
npm test
or
yarn test
- I really liked to code this app.