A simple application that helps manage a library and its processes like stocking, tracking and renting books.
Built on Nodejs
.
You will need to have the following installed in your working environment before this application can work.
- Latest version of Nodejs - comes with a Node Package Manager
- Postgresql
- Download or clone this branch at https://github.com/adesege/HelloBooks.git
- Install dependencies by running
npm install
. Ensure you are in your working directory. Runcd /path/to/HelloBooks
to change. - Go to client directory and run
npm run install
to install dependencies. - Go to the root dir
cd ../
- Then type
npm run transpile
to transpile from es6 to es5 - and then run
npm run start:dev
in your terminal to start the server. - To start the client,
cd client
- Then
npm run start
The server and client listens on port 5000
and 3000
by default respectively unless otherwise stated as an environment variable.
Visit http://localhost:3000
to access the front end and http://localhost:5000/api
to access the api
endpoint.
This application uses JSON web token to sign and verify users. The default expiration time is 24 hours
but this can be modified in the application config.
Some endpoints are restricted to logged users and admins only. E.g. Only admin can access api/:versionNumber/books/stocks
.
There are two middlewares defined in this application.
- authMiddleware - verifies a user's token and checks if the user is valid.
- adminMiddleware - checks if the user is
admin
.
If Ruby is already installed, but the bundle command doesn't work, just run
gem install bundler
in a terminal.
cd slate
from the root directory.- Initialize and start Slate. You can either do this locally, or with Vagrant:
npm run slate:install
# then
npm run slate:build
# finally
npm run slate:start
# OR run this to run with vagrant
vagrant up
Please visit the application documentation at http://hellobooks.herokuapp.com/docs/v1 or http://localhost:4567 to test locally
To deploy generated files into your application, run npm run slate:build
There are three different kind of testing in this application; client, server and end-to-end testing.
To start the server test. In your CMD, run
npm run test
# To get coverage result, run
npm run test:coverage
To start the end-to-end test
# For the first time you are running it,
# you'll need to install the selenium server and chrome driver.
# To do that, run
npm run test:e2e-install
# then start the server with
npm run test:e2e-server
# finally, run the test with
npm run test:e2e
Ensure that the server and client are up and running. The client must listen to port 3000. Otherwise, change it in nightwatch.conf:16
Finally, for the client test,
# first cd to the test folder
# then run
npm run test
# for coverage report, run
npm run test:coverage
Temitayo Fadojutimi is a Software Developer at Andela and he dedicates his expertise to solving practical problems in the society. He tweets at @adesege_
Thank you for your interest in contributing to this package. I currently accept contributions from everyone but I expect that standards are maintained. To contribute,
- Fork the project
- Create a feature branch, branch away from
master
- Write tests, using
Mocha and Chai
or any other testing frameworks, and code - If you have multiple commits please combine them into a few logically organized commits by squashing them.
- Push the commit(s) to your fork
- Submit a merge request (MR) to the
master
branch - The MR title should describe the change you want to make
- The MR description should give a motive for your change and the method you used to achieve it.
- Mention the issue(s) your merge request solves, using the
Solves #XXX
orCloses #XXX
syntax to auto-close the issue(s) once the merge request will be merged. - Be prepared to answer questions and incorporate feedback even if requests for this arrive weeks or months after your MR submission
- If a discussion has been addressed, select the "Resolve discussion" button beneath it to mark it resolved.
- When writing commit messages please follow these guidelines.
This project is licensed under the MIT license. Click here to read the license in full