Server for Building products with javascript course use case
This is a simple REST API server that provides CRUD capabilities for the experts polling use-case. The server is build using Express.js as a server and Passport.js as authentication middleware with code compiled from ES2015+ by babel It relies on RethinkDB as a database for storing data.
Experts server can be launched in two ways - using docker, or using node.
An assembled docker image is automatically published on Docker Hub after every push. First, make sure rethinkdb is running in your docker, e.g. by running:
$ docker run -d --name expertsdb rethinkdb
After that, all you have to do to run experts server locally is execute the following docker command:
$ docker run -d --link expertsdb -e EXPERTS_DB_URL=expertsdb -p 8080:8080 yamalight/bpwjs-server
This will start experts server in daemon mode, link it with your instance of rethinkdb and forward port 8080 to your docker host so you can access it.
You can also replace -d
flag with -it
flags to get interactive session and see the output of server in your console.
Running using Node requires you having Node.js v4 or later (v6 is recommended) installed. To run the server locally, do the following:
- Clone this repository
- Enter
./server
folder - Install dependencies with
npm install
- Make sure you have local RethinkDB running (or start one using
npm run db:create
, requires docker) - Start the server using
npm start
- Navigate to http://localhost:8080 in your browser
Development requires you having Node.js v4 or later installed.
To run server for development just follow instuctions from Using Node section.
To run test suite simply execute npm test
.
To see all available commands, see package.json.
For bug fixes, documentation changes, and small features:
- Fork this repository
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
For larger new features: Do everything as above, but first also make contact with the project maintainers to be sure your change fits with the project direction and you won't be wasting effort going in the wrong direction.
Thanks to all the people who helped to make this project better: