From 493918da3266911177b3fac3a356d5c4663b50fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=87=95=E9=B9=8F?= Date: Sun, 27 Sep 2020 18:08:10 +0800 Subject: [PATCH] init --- .gitignore | 1 + .meteor/.finished-upgraders | 19 +++++++ .meteor/.gitignore | 1 + .meteor/.id | 7 +++ .meteor/packages | 24 +++++++++ .meteor/platforms | 2 + .meteor/release | 1 + .meteor/versions | 88 +++++++++++++++++++++++++++++++++ client/main.css | 4 ++ client/main.js | 22 +++++++++ client/mainLayout.html | 17 +++++++ client/templates/loading.html | 3 ++ client/templates/main_item.html | 7 +++ client/templates/main_item.js | 8 +++ client/templates/userPage.html | 5 ++ lib/MyRes.js | 3 ++ lib/router.js | 24 +++++++++ package.json | 22 +++++++++ server/main.js | 8 +++ server/publication.js | 7 +++ 20 files changed, 273 insertions(+) create mode 100644 .gitignore create mode 100644 .meteor/.finished-upgraders create mode 100644 .meteor/.gitignore create mode 100644 .meteor/.id create mode 100644 .meteor/packages create mode 100644 .meteor/platforms create mode 100644 .meteor/release create mode 100644 .meteor/versions create mode 100644 client/main.css create mode 100644 client/main.js create mode 100644 client/mainLayout.html create mode 100644 client/templates/loading.html create mode 100644 client/templates/main_item.html create mode 100644 client/templates/main_item.js create mode 100644 client/templates/userPage.html create mode 100644 lib/MyRes.js create mode 100644 lib/router.js create mode 100644 package.json create mode 100644 server/main.js create mode 100644 server/publication.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/.meteor/.finished-upgraders b/.meteor/.finished-upgraders new file mode 100644 index 0000000..c07b6ff --- /dev/null +++ b/.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 diff --git a/.meteor/.gitignore b/.meteor/.gitignore new file mode 100644 index 0000000..4083037 --- /dev/null +++ b/.meteor/.gitignore @@ -0,0 +1 @@ +local diff --git a/.meteor/.id b/.meteor/.id new file mode 100644 index 0000000..8278ff4 --- /dev/null +++ b/.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 diff --git a/.meteor/packages b/.meteor/packages new file mode 100644 index 0000000..dc7487e --- /dev/null +++ b/.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 diff --git a/.meteor/platforms b/.meteor/platforms new file mode 100644 index 0000000..efeba1b --- /dev/null +++ b/.meteor/platforms @@ -0,0 +1,2 @@ +server +browser diff --git a/.meteor/release b/.meteor/release new file mode 100644 index 0000000..019e3ae --- /dev/null +++ b/.meteor/release @@ -0,0 +1 @@ +METEOR@1.11.1 diff --git a/.meteor/versions b/.meteor/versions new file mode 100644 index 0000000..0bdc45c --- /dev/null +++ b/.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 diff --git a/client/main.css b/client/main.css new file mode 100644 index 0000000..7f354f0 --- /dev/null +++ b/client/main.css @@ -0,0 +1,4 @@ +body { + padding: 10px; + font-family: sans-serif; +} diff --git a/client/main.js b/client/main.js new file mode 100644 index 0000000..e6a9a4e --- /dev/null +++ b/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); + }, +}); diff --git a/client/mainLayout.html b/client/mainLayout.html new file mode 100644 index 0000000..2f900e2 --- /dev/null +++ b/client/mainLayout.html @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/client/templates/loading.html b/client/templates/loading.html new file mode 100644 index 0000000..c0b72b5 --- /dev/null +++ b/client/templates/loading.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/client/templates/main_item.html b/client/templates/main_item.html new file mode 100644 index 0000000..51cab0b --- /dev/null +++ b/client/templates/main_item.html @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/client/templates/main_item.js b/client/templates/main_item.js new file mode 100644 index 0000000..a9615fc --- /dev/null +++ b/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() + } +}) \ No newline at end of file diff --git a/client/templates/userPage.html b/client/templates/userPage.html new file mode 100644 index 0000000..540968d --- /dev/null +++ b/client/templates/userPage.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/lib/MyRes.js b/lib/MyRes.js new file mode 100644 index 0000000..72a6316 --- /dev/null +++ b/lib/MyRes.js @@ -0,0 +1,3 @@ +UrlRes = new Mongo.Collection('url_res') +User = new Mongo.Collection('t_user') +// User.insert({username: 'nelson'}) \ No newline at end of file diff --git a/lib/router.js b/lib/router.js new file mode 100644 index 0000000..44f8eca --- /dev/null +++ b/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) + } +}) + diff --git a/package.json b/package.json new file mode 100644 index 0000000..158e63f --- /dev/null +++ b/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" + } +} diff --git a/server/main.js b/server/main.js new file mode 100644 index 0000000..333c92f --- /dev/null +++ b/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 +}); diff --git a/server/publication.js b/server/publication.js new file mode 100644 index 0000000..5e899a9 --- /dev/null +++ b/server/publication.js @@ -0,0 +1,7 @@ +Meteor.publish("url_res",function () { + return UrlRes.find() +}) + +Meteor.publish("user_res",function () { + return User.find() +}) \ No newline at end of file