Giter Site home page Giter Site logo

dropbox's Introduction

This is the Drop box project

The project consists of a REST server (using Hapi), a TCP server 
and a TCP client.  The idea is to have the client have the same 
directory as the server.  The TCP client will connect to the TCP 
server on port 8001.  The TCP server will listen to file system 
events such as new directory/file created, updated, and removal.  
When the event occur, it will push a message to the TCP client.  
The client will take appropriate actions regarding the event. 
For example, if a new file is created on the server, the TCP server
 will send a message to the TCP client for adding a new file.  
The TCP client will make a request call to the REST server (on port 8000) 
to get the content of the file.  It will then create the file from the 
content of the REST server.

Time spent

 15 hours

Starting the server (both Hapi: port 8000 and TCP server: port 8001)

npm install
npm start -- [options]

####Options

--dir : the base directory for the server to serve up files and diretories.

Starting the TCP client

npm install
npm run client -- [options]

####Options

--dir : the base directory for the client will sync up the file system with the server

####Usage

Use curl command to test the server.  While the servers are running,
open up another terminal and issue:

	1. get the file:

		curl -X GET http://127.0.0.1:8000/path/to/file

	2. get files form dir
		curl -X GET http://127.0.0.1:8000/path/to/dir/

    3. get file info using header

        curl -X GET http://127.0.0.1:8000/path/to/file --head

    4. get entire directory in the form of a tar

        curl -X GET http://127.0.0.1:8000/ -H "Accept: application/x-gtar"      

    5. It follows the same format as #1 and #2 to server file or directory 
       for the following methods: PUT/POST/DELETE by adding -X {method}.  With
       the exception of the POST on a directory (path ends in '/'), which is
       not allowed.
    
    6. synching up the file system from server and client
        1. start up the server
        2. start up the client
        3. go to the directory where the server serves up the file system,
           default is current working directory or if you provide the --dir,
           it will be there.
        4. go to the client directory where the client sync up the file system,
           defaults to <cwd>/source or --dir/source
        5. add a file to the server directory, you should see the newly added 
           file in the client/source directory.  Same goes
           with creating a new directory, client/source should
           have it also.  Same goes to update and delete operations on the
           server path.  

Demo

dropbox's People

Contributors

duylebao avatar

Watchers

 avatar

dropbox's Issues

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.