Todolist MongoDB
Todolist implemented for Cloudant (MongoDB) backend
![Swift 3 6-06](https://img.shields.io/badge/Swift%203-6/20 SNAPSHOT-blue.svg)
Initial Setup:
-
Download the Swift DEVELOPMENT 06-06 snapshot
-
Download MongoDB
You can use
brew install mongodb
If you are using mongodb for the first time create the directory to which the mongod process will write datamkdir -p /data/db
More information can be found here
Additionally, you can view the database' shell with
mongo
-
Clone the TodoList-mongodb repository
Running Locally:
-
You can start your database by running
mongod
-
Build the project and run it
swift build ./build/debug/todolist-mongodb
-
Open the TodoList Client and enjoy!
Setting up MongoDB by Compose
-
Get an account for Compose
-
Navigate to deployment section on the side bar. Select MongoDB and set your deployment name, location, and disable SSL access
-
Create Deployment and you should see a field for your connection info.
-
Setup a new database called
todolist
-
Setup a collection with
todolist
calledtodos
-
Add a new user to the
todolist
database
Now, you can access your Mongo Database with the given host and port or connect it to bluemix
Deploying To Bluemix:
-
Get an account for Bluemix
Setup the MongoDB Service
-
If you haven't already, setup MongoDB by Compose described in the section above
-
Select the MongoDB by Compose Service
-
Set the Service name as
TodoList-MongoDB
then initialize the Host, Port, Username, and Password to the values instantiated in the above section -
Upon creation, you should see your unbound service on the dashboard page
Next Steps: Push to Bluemix
-
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.
2 of 2 instances running
App started
Testing:
- Run the test cases locally with
git submodule init
git submodule update
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.