Bladeren bron

init

master
燕鹏 4 jaren geleden
commit
493918da32
  1. 1
      .gitignore
  2. 19
      .meteor/.finished-upgraders
  3. 1
      .meteor/.gitignore
  4. 7
      .meteor/.id
  5. 24
      .meteor/packages
  6. 2
      .meteor/platforms
  7. 1
      .meteor/release
  8. 88
      .meteor/versions
  9. 4
      client/main.css
  10. 22
      client/main.js
  11. 17
      client/mainLayout.html
  12. 3
      client/templates/loading.html
  13. 7
      client/templates/main_item.html
  14. 8
      client/templates/main_item.js
  15. 5
      client/templates/userPage.html
  16. 3
      lib/MyRes.js
  17. 24
      lib/router.js
  18. 22
      package.json
  19. 8
      server/main.js
  20. 7
      server/publication.js

1
.gitignore

@ -0,0 +1 @@
node_modules/

19
.meteor/.finished-upgraders

@ -0,0 +1,19 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.
notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1.2.0-standard-minifiers-package
1.2.0-meteor-platform-split
1.2.0-cordova-changes
1.2.0-breaking-changes
1.3.0-split-minifiers-package
1.4.0-remove-old-dev-bundle-link
1.4.1-add-shell-server-package
1.4.3-split-account-service-packages
1.5-add-dynamic-import-package
1.7-split-underscore-from-meteor-base
1.8.3-split-jquery-from-blaze

1
.meteor/.gitignore

@ -0,0 +1 @@
local

7
.meteor/.id

@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics
k49kua8621y.xj48caqc2ban

24
.meteor/packages

@ -0,0 +1,24 @@
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-base@1.4.0 # Packages every Meteor app needs to have
mobile-experience@1.1.0 # Packages for a great mobile UX
mongo@1.10.0 # The database Meteor supports right now
blaze-html-templates # Compile .html files into Meteor Blaze views
jquery # Wrapper package for npm-installed jquery
reactive-var@1.0.11 # Reactive variable for tracker
tracker@1.2.0 # Meteor's client-side reactive programming library
standard-minifier-css@1.6.1 # CSS minifier run for production mode
standard-minifier-js@2.6.0 # JS minifier run for production mode
es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers
ecmascript@0.14.3 # Enable ECMAScript2015+ syntax in app code
typescript@3.7.6 # Enable TypeScript syntax in .ts and .tsx modules
shell-server@0.5.0 # Server-side component of the `meteor shell` command
insecure@1.0.7 # Allow all DB writes from clients (for prototyping)
iron:router
sacha:spin

2
.meteor/platforms

@ -0,0 +1,2 @@
server
browser

1
.meteor/release

@ -0,0 +1 @@
METEOR@1.11.1

88
.meteor/versions

@ -0,0 +1,88 @@
allow-deny@1.1.0
autoupdate@1.6.0
babel-compiler@7.5.3
babel-runtime@1.5.0
base64@1.0.12
binary-heap@1.0.11
blaze@2.3.4
blaze-html-templates@1.1.2
blaze-tools@1.0.10
boilerplate-generator@1.7.1
caching-compiler@1.2.2
caching-html-compiler@1.1.3
callback-hook@1.3.0
check@1.3.1
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
ddp-server@2.3.2
deps@1.0.12
diff-sequence@1.1.1
dynamic-import@0.5.2
ecmascript@0.14.3
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.11.0
ecmascript-runtime-server@0.10.0
ejson@1.1.1
es5-shim@4.8.0
fetch@0.1.1
geojson-utils@1.0.10
hot-code-push@1.0.4
html-tools@1.0.11
htmljs@1.0.11
id-map@1.1.0
insecure@1.0.7
inter-process-messaging@0.1.1
iron:controller@1.0.12
iron:core@1.0.11
iron:dynamic-template@1.0.12
iron:layout@1.0.12
iron:location@1.0.11
iron:middleware-stack@1.1.0
iron:router@1.1.2
iron:url@1.1.0
jquery@1.11.11
launch-screen@1.2.0
livedata@1.0.18
logging@1.1.20
meteor@1.9.3
meteor-base@1.4.0
minifier-css@1.5.3
minifier-js@2.6.0
minimongo@1.6.0
mobile-experience@1.1.0
mobile-status-bar@1.1.0
modern-browsers@0.1.5
modules@0.15.0
modules-runtime@0.12.0
mongo@1.10.0
mongo-decimal@0.1.1
mongo-dev-server@1.1.0
mongo-id@1.0.7
npm-mongo@3.8.1
observe-sequence@1.0.16
ordered-dict@1.1.0
promise@0.11.2
random@1.2.0
reactive-dict@1.3.0
reactive-var@1.0.11
reload@1.3.0
retry@1.1.0
routepolicy@1.1.0
sacha:spin@2.3.1
shell-server@0.5.0
socket-stream-client@0.3.1
spacebars@1.0.15
spacebars-compiler@1.1.3
standard-minifier-css@1.6.1
standard-minifier-js@2.6.0
templating@1.3.2
templating-compiler@1.3.3
templating-runtime@1.3.2
templating-tools@1.1.2
tracker@1.2.0
typescript@3.7.6
ui@1.0.13
underscore@1.0.10
webapp@1.9.1
webapp-hashing@1.0.9

4
client/main.css

@ -0,0 +1,4 @@
body {
padding: 10px;
font-family: sans-serif;
}

22
client/main.js

@ -0,0 +1,22 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import './mainLayout.html';
import './templates/main_item.js'
import '/lib/router'
Template.hello.onCreated(function helloOnCreated() {
this.counter = new ReactiveVar(0);
});
Template.hello.helpers({
counter() {
return Template.instance().counter.get();
},
});
Template.hello.events({
'click button'(event, instance) {
instance.counter.set(instance.counter.get() + 1);
},
});

17
client/mainLayout.html

@ -0,0 +1,17 @@
<template name="mainLayout">
<head>
<title>myapp</title>
</head>
<body>
<h1>Welcome to Meteor!</h1>
<a href="{{pathFor "mainItem"}}">test url</a>
{{> hello}}
{{> yield}}
</body>
</template>
<template name="hello">
<button>Click Me</button>
<p>You've pressed the button {{counter}} times.</p>
</template>

3
client/templates/loading.html

@ -0,0 +1,3 @@
<template name="loading">
{{> spinner}}
</template>

7
client/templates/main_item.html

@ -0,0 +1,7 @@
<template name="mainItem">
<ul>
{{#each main_datas}}
<li><a href="{{url}}" target="_blank">{{title}}</a></li>
{{/each}}
</ul>
</template>

8
client/templates/main_item.js

@ -0,0 +1,8 @@
import "./main_item.html"
import "/lib/MyRes"
Template.mainItem.helpers({
main_datas: function (){
return UrlRes.find()
}
})

5
client/templates/userPage.html

@ -0,0 +1,5 @@
<template name="userPage">
<div>
用户名:{{username}}
</div>
</template>

3
lib/MyRes.js

@ -0,0 +1,3 @@
UrlRes = new Mongo.Collection('url_res')
User = new Mongo.Collection('t_user')
// User.insert({username: 'nelson'})

24
lib/router.js

@ -0,0 +1,24 @@
import "/client/templates/loading.html"
import "/client/templates/userPage.html"
Router.configure({
layoutTemplate: 'mainLayout',
loadingTemplate: 'loading',
waitOn: function () {
return Meteor.subscribe("url_res")
}
})
Meteor.subscribe('user_res')
Router.route("/")
Router.route("/nelson", {name: 'mainItem'})
Router.route("/user/:_id", {
name: 'userPage',
data(){
return User.findOne(this.params._id)
}
})

22
package.json

@ -0,0 +1,22 @@
{
"name": "myapp",
"private": true,
"scripts": {
"start": "meteor run",
"test": "meteor test --once --driver-package meteortesting:mocha",
"test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
"visualize": "meteor --production --extra-packages bundle-visualizer"
},
"dependencies": {
"@babel/runtime": "^7.11.2",
"jquery": "^3.5.1",
"meteor-node-stubs": "^1.0.1"
},
"meteor": {
"mainModule": {
"client": "client/main.js",
"server": "server/main.js"
},
"testModule": "tests/main.js"
}
}

8
server/main.js

@ -0,0 +1,8 @@
import { Meteor } from 'meteor/meteor';
import "/lib/MyRes"
import "./publication"
Meteor.startup(() => {
// code to run on server at startup
});

7
server/publication.js

@ -0,0 +1,7 @@
Meteor.publish("url_res",function () {
return UrlRes.find()
})
Meteor.publish("user_res",function () {
return User.find()
})
Laden…
Annuleren
Opslaan