Git Product home page Git Product logo

adserver-prototype's Introduction

adserver-prototype

Build Status

Prototype of an adserver that chooses ads based on campaign constraints. The prototype focuses on the ad selection process.

How to read the source

If your favorite editor is not set up for Haskell, consider generating the documentation, which will also create syntax highlighted source code where identifiers are links to their definitions. See below for how to generate and find the documentation.

If you want to navigate to the source files on the file system, here are the interesting parts of the project layout:

  • The src/lib/AdServer/*.hs files contain the implementation.

  • The src/lib/AdServer/Server.hs file contains the main function, the entry point for the server.

  • The src/test/AdServer/*/Test.hs files contain unit test.

How to build the server

  • Install https://www.haskellstack.org
  • Clone repository
  • Run stack build in the top-level directory of the repository (where the stack.yml configuration file is)
  • If stack tells you to run stack setup, do so to install the Haskell toolchain.

The first build can take some time because stack will download and compile all (transitive) dependencies. Later builds will be faster.

How to run automated tests

  • Run stack test in the top-level directory of the repository.

    The first run will download and build the (transitive) dependencies of the test-suite, so it can take some more time. Later test runs will be faster.

How to run the server

  • First build the server (see above)

  • Run stack exec adserver-prototype in the top-level directory of the repository.

  • The server should start and tell you that it listens at port 8081.

  • If you need it to listen at another port, edit the let port = 8081 line in src/lib/AdServer/Server.hs.

  • You can make requests such as

    curl -i http://localhost:8081/ads/foo
    

    which should return "foo".

  • Use Ctrl-C to shut down the server.

How to generate and view documentation

The source code has documentation comments for all top-level entities. Use haddock (the Haskell documentation tool) to generate the documentation as follows:

  • Run stack haddock in the top-level directory of the repository.

    The first documentation run can take some time because stack will generate documentation for all (transitive) dependencies. Later runs will be faster.

  • At the end of the output, stack haddock will print the locations of three html files:

    Updating Haddock index for local packages in
    .../.stack-work/install/.../doc/index.html
    Updating Haddock index for local packages and dependencies in
    .../.stack-work/install/.../doc/all/index.html
    Updating Haddock index for snapshot packages in
    .../snapshots/.../doc/index.html
    

    The first HTML file contains links to the documentation for all modules in my application. The second file contains the same links, and also links to the modules in all transitive dependencies.

  • In Haddock documentation, all types are hyperlinked. So if you follow links, you'll move from the documentation of my code to the dependencies or the standard library. My code are the modules in the AdServer.* hierarchy.

  • In Haddock documentation, documentation entries have a link "Source" at the right-hand side of the gray bar. It leads to syntax-highlighted source code where all identifiers are links to their definitions. If your editor is not configured for Haskell, that might be the easiest way to read the code.

adserver-prototype's People

Contributors

toxaris avatar

Watchers

 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.