SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
Pump.io進度報告
partI
2013/7/15
13年7月15⽇日星期⼀一
目標
概述
目前進度
架設過程
Demo
13年7月15⽇日星期⼀一
概述:What is Pump.io?
pump.io is an activity stream server
that models a social network
REST API
13年7月15⽇日星期⼀一
Activities
記錄發生什麼事情
主詞 - 動詞 - 物件結構
可擴展的結構
13年7月15⽇日星期⼀一
Subject - Verb - Object
原生動作:Like, Post...
也可以自己定義:hate, ate...
ex:
Evan posted a photo
Bill ate a breakfast burrito at Celia's.
13年7月15⽇日星期⼀一
Audience
概念像是follow
只有 audience 可以看到活動
ex:
All Laura’s followers
People on David’s “Family” list
13年7月15⽇日星期⼀一
Streams
活動的集合
圍繞一個主題舉辦
ex:
The activities Bill did
The activities about an image
13年7月15⽇日星期⼀一
REST API
JSON 回傳
所有的 streams 接可讀
有的可以寫
13年7月15⽇日星期⼀一
Representing Objects
Unique ID
Object type
Other information varies by type
{
"id": "tag:social.example,2013:user:1481",
"objectType": "person",
"displayName": "Evan Prodromou",
"url": "http://social.example/evanp",
"image": {
"url": "http://avatar.social.example/evanp.jpg"
}
}
13年7月15⽇日星期⼀一
Representing activities
Actor(an object)
Verb
Object(object)
Summary
{
"id": "urn:uuid:85e80e20-cd1b-11e2-82f1-c8f73398600c",
"actor": {
"id": "tag:social.example,2013:user:1481",
"objectType": "person"
},
"verb": "create",
"object": {
"id": "http://social.example/note/13",
"objectType": "note",
"content": "Hello, World"
},
"summary": "Evan created a note."
}
13年7月15⽇日星期⼀一
目前進度
架設完成,差SSL
可以運行第三方活動,但是還無法登入
了解整體架構中
13年7月15⽇日星期⼀一
架設過程
node.js,其中運用到非常多的套件
Database : mongoDB or redis
Database firmware : databank
13年7月15⽇日星期⼀一
git clone -> 下載整個專案
npm install -> 從 package.json 的設定中,安
裝需要的套件
npm install databank-mongodb or databank-
redis -> 安裝node.js app 與 database 連結的
firmware
13年7月15⽇日星期⼀一
pump.io.json
整個 pump.io 的設定檔
需要放到 /etc 這個目錄之下
有許多的 key - value
13年7月15⽇日星期⼀一
執行
先要把 mongoDB 或是 redis 建立起來
mongoDB -> mongod --dbpath=dbs 將資料放
到dbs這個目錄之下,mongo 啟動 client 端的
管理資料庫介面。
redis -> src/redis-server 啟動資料庫,src/
redis-cli 啟動 client 端的管理資料庫介面
13年7月15⽇日星期⼀一
npm start -> 運行pump.io
會建立cluster,每個 instance 都會開啟一個
app
13年7月15⽇日星期⼀一
結構
npm start 其實是要npm依照package.json的設
定來運行,設定維運行 bin/pump 這個執行
檔。
執行檔中除了將 etc/pump.io.json 讀入之外,
並建立了複數個cluster,每一個cluster都會去
建立一個node.js app
makeApp(config, function(err, app) {
if (err) {
console.log(err);
process.exit(1);
} else {
app.run(function(err) {});
}
13年7月15⽇日星期⼀一
app.js
依照 express 套件的架構建立一個 app,
express 套件的重點就是有一套完整的 route
規則,相當輕鬆就可以建立REST api。
app.js中除了載入route之外,也設定了像是與
資料庫連線等等。
route 的規則被獨立成幾個file,像是
web.js(web頁面)以及api.js(api功能)
13年7月15⽇日星期⼀一
web.js
輸入url,導到該頁面
ex:
url : http://127.0.0.1/
app.get("/", app.session, principal,
addMessages, showMain);
表示此url會觸發這個get的事件,後面的參
數部分是變數,部分是函式
13年7月15⽇日星期⼀一
showMain()
showMain函式將前面的參數帶入,並判別目前
使否維登入狀態
已登入 -> 個人頁面,未登入 -> 起始頁面
var showMain = function(req, res, next) {
if (req.principalUser) {
req.log.info({msg: "Showing inbox for logged-in user", user:
req.principalUser});
showInbox(req, res, next);
} else {
req.log.info({msg: "Showing welcome page"});
res.render("main", {page: {title: "Welcome", url:
req.originalUrl}});
}
};
13年7月15⽇日星期⼀一
前端介面
backbone.js
utml template
13年7月15⽇日星期⼀一
main.utml
<div id="main">
<div class="hero-unit">
<div class="row">
<div class="span6">
<h1><%- config.site %></h1>
<p>This site runs <a href="http://pump.io/">pump.io</a>, the
! high-performance Open Source social engine. It pumps your life
! in and out of your friends, family and colleagues.
</p>
<p><a class="btn primary large" href="/main/register">Get Started
&raquo;</a></p>
</div>
<div class="span4">
<img src="images/somefriends.jpg" width="340" height="235"
class="img-rounded" />
</div>
</div>
</div>
</div>
13年7月15⽇日星期⼀一
其他的tag咧?
(body, head...)
13年7月15⽇日星期⼀一
backbone.js
backbone.js的機制,一個固定的模組,並將中
間抽換成utml建立的頁面
還沒有研究很深刻
以上
網址:http://pump.io、https://e14n.com
13年7月15⽇日星期⼀一

Contenu connexe

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

2013:7:15 pump