MongoDB implementation of TodoList
Swift
Latest commit c71800a Dec 13, 2016 @tfrank64 tfrank64 committed on GitHub Merge pull request #9 from Joannis/master
Added support for MongoKitten 3

README.md

Todolist MongoDB

Todolist implemented for MongoDB backend

Build Status Swift

Initial Setup:

  • Download XCode 8 on macOS or the latest linux Swift 3.0 Release

  • Download MongoDB

    • macOS
      $ brew install mongodb
    
    • linux
      $ sude apt-get mongodb
    

    If you are using mongodb for the first time, create the directory to which the mongod process will write data

    mkdir -p /data/db
    mkdir -p ~/log
    

    More information can be found here

    Additionally, you can view the database' shell with $ mongo

  • Clone the TodoList-mongodb repository

Running Locally:

  1. You can start your database by running mongod

  2. Build the project and run it

    • macOS
      swift build
      ./build/debug/TodoList
    
    • linux
      swift build -Xcc -fblocks -Xlinker -rpath -Xlinker .build/debug 
      ./build/debug/TodoList
    
  3. Open the TodoList Client and enjoy!

Setting up MongoDB by Compose

  1. Get an account for Compose

  2. Navigate to deployment section on the side bar. Select MongoDB and set your deployment name, location, and disable SSL access

    MongoDB by Compose

  3. Create Deployment and you should see a field for your connection info.

    MongoDB by Compose

  4. Setup a new database called todolist

  5. Setup a collection with todolist called todos

    MongoDB by Compose

  6. Add a new user to the todolist database

    MongoDB by Compose

    MongoDB by Compose

Now, you can access your Mongo Database with the given host and port or connect it to bluemix

Deploying To Bluemix:

  1. Get an account for Bluemix

    Setup the MongoDB Service

  2. If you haven't already, setup MongoDB by Compose described in the section above

  3. Select the MongoDB by Compose Service

    MongoDB by Compose

  4. Set the Service name as TodoList-MongoDB then initialize the Host, Port, Username, and Password to the values instantiated in the above section

    MongoDB by Compose

  5. Upon creation, you should see your unbound service on the dashboard page

    Next Steps: Push to Bluemix

  6. Download and install the Cloud Foundry tools:

cf login
bluemix api https://api.ng.bluemix.net
bluemix login -u username -o org_name -s space_name
Be sure to change the directory to the todolist-mongodb directory where the manifest.yml file is located.
  1. Run cf push

    Note: The uploading droplet stage should take a long time, roughly 4-6 minutes. If it worked correctly, it should say:

2 of 2 instances running
App started

Testing:

  • Run the test cases from within your local repository
$ git clone https://github.com/IBM-Swift/todolist-tests Tests
$ swift test
  • Alternatively, checkout the specs on TodoList-Backend and set the appropriate url to test

License

This library is licensed under Apache 2.0. Full license text is available in LICENSE.