vintage-auth 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +15 -14
- package/package.json +7 -2
package/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
onst express = require('express')
|
|
2
|
+
const mongoose = require('mongoose')
|
|
3
|
+
const authRoutes = require('./routes/auth')
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function vintageAuth(config) {
|
|
6
|
+
const { mongoUri, jwtSecret } = config
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
mongoose.connect(mongoUri)
|
|
9
|
+
.then(() => console.log('✅ vintage-auth: MongoDB connected'))
|
|
10
|
+
.catch(err => console.log('❌ vintage-auth: DB Error', err))
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
const authRouter = vintageAuth({
|
|
13
|
-
mongoUri: 'mongodb://localhost:27017/vintage',
|
|
14
|
-
jwtSecret: 'supersecret_dev_key'
|
|
15
|
-
})
|
|
12
|
+
process.env.VINTAGE_JWT_SECRET = jwtSecret
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
const router = express.Router()
|
|
15
|
+
router.use('/auth', authRoutes)
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
return router
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = vintageAuth
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vintage-auth",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Drop-in auth system for Express apps",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"keywords": [
|
|
6
|
+
"keywords": [
|
|
7
|
+
"auth",
|
|
8
|
+
"express",
|
|
9
|
+
"jwt",
|
|
10
|
+
"mongodb"
|
|
11
|
+
],
|
|
7
12
|
"license": "MIT",
|
|
8
13
|
"dependencies": {
|
|
9
14
|
"bcryptjs": "^2.4.3",
|