import express from 'express'
const app = express()
app.listen(3000)
const weChat = new WeChat(appId, appSecret, {
token : 'token',
symmetricKey : 'symmetricKey'
})
app.post('/event', weChat.event())
app.get('/auth', weChat.authenticate({
callbackURL: 'http://example.com/auth/callback'
}))
app.get('/auth/callback', weChat.authenticate())
app.get('/app/:id/auth', weChat.appAuthenticate({
callbackURL: (req) => `http://example.com/app/${req.params.id}/callback`
}))
app.get('/app/:id/callback', weChat.appAuthenticate({}, (err, req, res, next, data) => {
res.json(data)
}))
app.get('/app/:id/js', weChat.js())
import express from 'express'
const app = express()
app.listen(3000)
const weChatApp = new WeChatApp(appId, appSecret)
app.get('/auth', weChatApp.authenticate({
callbackURL: 'http://example.com/auth/callback'
}))
app.get('/auth/callback', weChatApp.authenticate({}, (err, req, res, next, data) => {
res.json(data)
}))
app.get('/js', weChatApp.js())