Git Product home page Git Product logo

thesrc's Introduction

thesrc Build Status docs examples status views

thesrc is a news site for programmers that's intended to be an example of how to structure a large Go web app. While this app is not large itself, it demonstrates the same patterns as in the web app that powers Sourcegraph.com.

The web application architecture and patterns demonstrated here were presented in a talk at Google I/O 2014 entitled Building Sourcegraph, a large-scale code search engine in Go. See that talk for more details.

thesrc has a few special features of interest to programmers:

  • just the good stuff: an automated classifier rejects links that don't contain code or involve programming;
  • not a popularity contest: you can only see a link's score by mousing over it for a couple of seconds, and (TODO) freshly posted links are randomly rotated into the homepage;

Browse the code on Sourcegraph.

Installation

Use the thesrc command to interact with the app.

You can either run it directly:

go get -u sourcegraph.com/sourcegraph/thesrc/...
thesrc

Or inside Docker:

docker build -t thesrc && docker run thesrc

If you want to run it in Docker, substitute docker run thesrc for every instance of thesrc. (Also note that you'll have to pass Docker the necessary PG* environment variables to connect to the PostgreSQL database.)

Running

First, set the PG* environment variables so that psql works.

Then run these commands to create the DB, import posts from other sites, and classify their links:

# start the server:
thesrc -url=http://localhost:5000 serve

# then, in a separate terminal window, run:
thesrc -url=http://localhost:5000 createdb
thesrc -url=http://localhost:5000 import
thesrc -url=http://localhost:5000 classify

# now open your browser to localhost:5000

thesrc's People

Contributors

beyang avatar samertm avatar sqs 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.