百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

thesrc

> 编程语言
开源

一个 3 层 (前端、API、数据存储) Go Web 应用的示例 (基于驱动 https://sourcegraph.com 的代码)

396 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

一个 3 层 (前端、API、数据存储) Go Web 应用的示例 (基于驱动 https://sourcegraph.com 的代码)

thesrc

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:

bash
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

Issues· 3 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Go

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言