Giter Site home page Giter Site logo

christian-fei / telephone-directory Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 376 KB

A simple phone book to learn a bit more about Heroku, Travis CI and test driven development with Jasmine.

Home Page: http://telephone-directory.herokuapp.com/

JavaScript 91.45% CSS 8.55%

telephone-directory's Introduction

Telephone directory

A simple exercise to learn a bit more about Heroku, Travis CI and test driven development with Jasmine. The online version of this application can be found here

Build Status awesomeness

#About This application is a very basic phone book with which you can save informations about a person's name, surname and phone number[s]. I left out the whole auth system because it would go beyound the scope of this exercise.

###The stack I've chosen to build this application with Express and MongoDB because in my opinion it neatly meets the projects requirements:

  • the ability to talk client <-> server and server <-> database in JavaScript
  • simple and native JSON support on the client, server and database
  • no relational data (we can use an Array to store multiple numbers for a single person)

###Web app The web app has three pages:

  • Home page
    • Contains a text field that allows to search through all the entries by name or number. When I enter text in the field, the page will be reloaded with a table containing all the entries that match the text I entered. The page contains a link to the "add new entry" page. When an entry is displayed, it contains a link to the "edit this entry" page.
    • path /
  • Add new entry page
    • Contains a form for entering a new entry.
    • path /add
  • Edit entry page
    • Contains a form for modifying an existing entry.
    • path /edit/:id

I've added the ability to search for name and for phonenumbers. If the user is searching by phonenumber, the entries that partially match the criteria will be shown. When searching for name, the web app searches the database with a fuzzy search, to return search results even if the user mistyped a letter:

e.g: 'Mrc' will match 'Marco' and 'Marc'

#Tests The testing suite is jasmine-node.

To run the tests:

npm test
#or
jasmine-node .
#or to watch tests
jasmine-node . --watch --autotest --growl

#Deployment ###heroku

I've chosen Heroku as the PaaS of choice, so here are the steps needed to run your app in the cloud:

heroku apps:create [application name] --stack cedar
heroku config:set MONGO_URL=[your Mongo URL]
heroku ps:scale web=1
git push heroku master
heroku open

###locally This application uses Node and MongoDB, so both need to be installed on your system.

Install the npm dependencies by running

npm install

Next step is to create a Mongo database and get the URL for it. This because internally the app makes use of the environment variable called MONGO_URL.

You can set the environment variable with

export MONGO_URL=mongodb://<user>:<password>@localhost:27017/telephonedirectory

and then run

node app.js
#or foreman start if you have heroku installed

to start the app.

#License ###MIT licensed Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

telephone-directory's People

Contributors

christian-fei avatar

Stargazers

Marco Stevan avatar Felix De Montis avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.