微信小程序社区功能全栈解决方案,配合以下项目使用:
后端使用Egg,Mysql,Redis,基于Nodejs开发,全套代码使用ES6编写
微信小程序端
egg的微信小程序的用户会话管理插件,客户端需配合腾讯云出品的qcloud-weapp-client-sdk使用,Redis保存会话信息
本示例包含:
git clone https://github.com/seasonstar/egg-24time.git
cd egg-24time
Config Redis and Mysql on config/config.default.js
config.redis = {
client: {
host: '127.0.0.1',
port: '6379',
password: '',
db: '0',
},
};
config.sequelize = {
dialect: 'mysql', // support: mysql, mariadb, postgres, mssql
database: 'tftime',
host: 'localhost',
port: '3306',
username: 'root',
password: '',
};
config.weappSDK = {
appId: '', // your weapp appId
appSecret: '', // weapp appSecret
};
// Qcloud Cloud Object Storage
config.cos = {
secretId: '',
secretKey: '',
appId: '',
bucket: '',
folder: '',
};
Import test data into Mysql
mysql -u root -p < db.sql
$ npm install
$ npm run dev
$ open http://localhost:7001/
Use EGG_SERVER_ENV=prod
to enable prod mode
$ EGG_SERVER_ENV=prod npm start
or EGG_SERVER_ENV=prod nohup node index.js > stdout.log 2> stderr.log &
run quietly
npm run autod
to auto detect dependencies upgradenpm run lint
to check code stylenpm test
to run unit testPlease Open Issues if you have troubles.