Skip to content
Server for the CrowdShelf apps
JavaScript CSS HTML
Branch: dev
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
controllers Replace mailgun-js with mailgun-send Dec 23, 2015
emailTemplates Fix typo in emailTemplate for new user Dec 23, 2015
helpers Replace mailgun-js with mailgun-send Dec 23, 2015
models Handle notFound on update crowd Nov 4, 2015
public Fix error in Swagger URL spec for forgot and reset password Dec 23, 2015
.gitignore Setup structure and routes for GET and PUT Aug 26, 2015
Dockerfile Docker from Node:6 and remove MongoDB Jul 24, 2016
LICENCE Add licence Nov 4, 2015
README.md Correct envvar name MONGODB in Docker Compose Jul 24, 2016
docker-compose.yml Correct envvar name MONGODB in Docker Compose Jul 24, 2016
index.js Setup structure and routes for GET and PUT Aug 26, 2015
package.json
router.js Refactor router.js Dec 23, 2015
server.js

README.md

CrowdShelf server

Server for the CrowdShelf apps, written with NodeJS and Express.

Workflow

We're using JIRA for issue tracking. We try to follow Chrockfords style guide for our code.

Do you want to contribute? Do it like this:

  1. Pick a task to do on JIRA, or just something you want implemented yourself.
  2. On JIRA, assign the task to yourself and move it to "In progress".
  3. Create a new branch from master with a name that starts with the JIRA task name, and is followed by a short description. For example cs-32-user-management-api.
  4. Work, work. Commit often. Try to follow good commit practice. You can push your branch to GitHub if you want.
  5. When you're done, push your latest changes and create a pull request. Wait for someone other than yourself to give feedback etc. Work out any differences of opinion, and the pull request will be merged and deployed.

Any questions? Feel free to ask!

Installation

Get a local server by doing the following:

  1. Clone the repository with git@github.com:CrowdShelf/server.git
  2. cd into the folder
  3. Run npm install to install dependencies
  4. Set up Mongodb locally and export an environment variable MONGODB that defines its URL.
  5. You'll also need a Mailgun-account. Register, then export the following environment variables: MAILGUN_KEY and EMAIL_ADDRESS.
  6. Run npm start and you'll be up and running on port 3000, or an environment defined as PORT.

Project structure

server\
    controllers\ - Controllers for handling requsts
    models\ - Models that handle database-operations
    index.js - Starts a server
    server.js - Sets the server up, defines port etc.
    router.js - Sets the routing up by setting allowed headers etc. and calling API setup-methods 

Deployment

The server is currently running on a droplet on Digital Ocean. It has CI with the master-branch. You'll find it on crowdshelf.xyz/api.

There's also CI on the dev-branch, which is the latest version of the API. You'll find it on crowdshelf-dev.herokuapp.com/api

Docker

A Docker-image is avaiable on the Docker Hub.

You can get it with docker pull crowdshelf/server, and run it with
docker run --net host -e "MONGODB=mongo://yourURL" -e "MAILGUN_KEY=your Mailgun API key" -e "EMAIL_ADDRESS=adress to send from" crowdshelf/servernpm start The -e-parameter sets the environmental variables for your e-mail serivce and database. This will expose the ports 3000locally, which means you can reach the API under localhost:3000/api.

You can also build the image yourself with docker build -t crowdshelf/server .

Docker Compose

You can also spin everything up (app and MognoDB) with Docker Compose.

  1. Add your environment variables to docker-compose.yml.
  2. Run docker-compose up

Data model and API

Latest API definition can be found on our servers:

Licence

MIT-licence. See the LICENCE-file.

You can’t perform that action at this time.