Code Monkey home page Code Monkey logo

letusgo-team-d's Introduction

Base line of Let's Go server

This is a simple RESTFul server for Let' Go online shop server, it's written in Ruby for now. It contains some essential parts for get started with Web development very quickly.

  1. Sinatra as Web Server
  2. ActiveRecord as ORM
  3. Sqlite3 as database (single file database)
  4. RSpec as unit test framework
  5. Rake as build tools

Setup Environment

Since it's basically a Ruby Web application, you should firstly have Ruby installed. RVM is choosen as the Ruby Installer. In most cases, simply type:

$ curl -sSL https://get.rvm.io | bash -s stable 

will do the installation automatically for you. If you want to do some customization, here is a detailed guide.

Once the Ruby is installed, you need clone this repo to you local enviroment:

$ git clone [email protected]:abruzzi/letusgo-server.git
$ cd letusgo-server

And then you should be able to see something like:

ruby-1.9.3-p545 is not installed.
To install do: 'rvm install ruby-1.9.3-p545'

Try to following the instruction, and install the correct version of ruby. After that you need install the bundler gem by yourself, and use bundler to maintain other dependencies. Install bundler itself is easy:

$ gem install bundler

Then you can use command bundle to install all other gems:

$ bundle install

Once all the dependencies are installed, you are done of the environment part

Application setup

Now we will start to do the application setup. Firstly, do the database setup like this:

./setup.sh

After this, you should see there are 2 files end with .sqlite3 in the folder db/:

$ ls -al db/*.sqlite3
-rw-r--r--  1 jtqiu  staff  20480 Nov 16 13:29 db/development.sqlite3
-rw-r--r--  1 jtqiu  staff  20480 Nov 16 13:48 db/test.sqlite3

Then you can lunch your application by using shotgun like this:

$ shotgun

And you should see something like this:

== Shotgun/WEBrick on http://127.0.0.1:9393/
[2014-11-16 14:22:45] INFO  WEBrick 1.3.1
[2014-11-16 14:22:45] INFO  ruby 1.9.3 (2014-02-24) [x86_64-darwin14.0.0]
[2014-11-16 14:22:45] INFO  WEBrick::HTTPServer#start: pid=8889 port=9393

that means the application is started successfully, type http://127.0.0.1:9393/products in your browser and you should see an empty array like [], then you are done.

Use Ctrl-C to terminate the application, try to run the following command to test the application:

$ RACK_ENV=test rake specs

And you should see 3 test cases are passing:

...

Finished in 0.11592 seconds (files took 0.60523 seconds to load)
3 examples, 0 failures

That's it.

letusgo-team-d's People

Contributors

zhaomengru2014 avatar sancoder-q avatar wing19 avatar abruzzi avatar zhanglin00129 avatar

Watchers

James Cloos avatar Melon 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.