This is a simple shell script that is designed to provision both nginx and node on your machine. I primarily wrote it for use with Vagrant and an example Vagrantfile
is included in the Gist as well.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPOST http://localhost:9200/test/articles/1 -d '{ | |
"content": "The quick brown fox" | |
}' | |
curl -XPOST http://localhost:9200/test/articles/2 -d '{ | |
"content": "What does the fox say?" | |
}' | |
curl -XPOST http://localhost:9200/test/articles/3 -d '{ | |
"content": "The quick brown fox jumped over the lazy dog" | |
}' | |
curl -XPOST http://localhost:9200/test/articles/4 -d '{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bson.objectid import ObjectId | |
class Project(object): | |
"""A class for storing Project related information""" | |
def __init__(self, project_id=None, title=None, description=None, price=0.0, assigned_to=None): | |
if project_id is None: | |
self._id = ObjectId() | |
else: | |
self._id = project_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
from bson.objectid import ObjectId | |
from project import Project | |
class ProjectsRepository(object): | |
""" Repository implementing CRUD operations on projects collection in MongoDB """ | |
def __init__(self): | |
# initializing the MongoClient, this helps to | |
# access the MongoDB databases and collections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from projects_repository import ProjectsRepository | |
from project import Project | |
def load_all_items_from_database(repository): | |
print("Loading all items from database:") | |
projects = repository.read() | |
at_least_one_item = False | |
for p in projects: | |
at_least_one_item = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Author: Brian Oliver II | |
Instagram: bolo_ne3 | |
License: | |
MIT License | |
Copyright (c) 2016 Brian Oliver II | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal |