Skip to content

Commit 0093897

Browse files
ip testing update
1 parent 69699a5 commit 0093897

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "koa-vue-notes-api",
3-
"version": "1.2.3",
3+
"version": "1.2.4",
44
"description": "A SPA using Koa as the backend and Vue as the frontend.",
55
"author": "John Datserakis",
66
"private": false,

readme.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,26 @@ npm run pretty
5656
# run tests
5757
npm run test
5858

59-
# knex migration examples
60-
# (from command line in root directory with knex installed globally)
61-
# (*make* commands are just here to show syntax)
62-
63-
# make migration
64-
knex migrate:make create_users_table
59+
## knex migrations ##
6560

6661
# migrate latest
6762
knex migrate:latest
6863

6964
# rollback
7065
knex migrate:rollback
7166

67+
# run all seeds
68+
knex seed:run
69+
70+
## knex seed and migration make commands ##
71+
72+
# make migration
73+
knex migrate:make create_users_table
74+
7275
# make seed
7376
knex seed:make seed_users
7477

75-
# run all seeds
76-
knex seed:run
78+
7779
```
7880

7981
## General Information

src/config/readme.md

Whitespace-only changes.

src/controllers/UserActionController.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class UserController {
101101

102102
//Let's grab their ipaddress
103103
//TODO: This doesn't work correctly because of the reverse-proxy
104-
request.ipAddress = ctx.request.ip
104+
request.ipAddress = ctx.ip
105105

106106
//Ok, at this point we can sign them up.
107107
try {
@@ -179,7 +179,7 @@ class UserController {
179179
ctx.userAgent.platform +
180180
' ' +
181181
ctx.userAgent.browser,
182-
ipAddress: ctx.request.ip,
182+
ipAddress: ctx.ip,
183183
expiration: dateAddMonths(new Date(), 1),
184184
}
185185

@@ -268,7 +268,7 @@ class UserController {
268268
ctx.userAgent.platform +
269269
' ' +
270270
ctx.userAgent.browser,
271-
ipAddress: ctx.request.ip,
271+
ipAddress: ctx.ip,
272272
expiration: dateAddMonths(new Date(), 1),
273273
}
274274

src/routes/userActions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const router = new Router()
88
const jwtMiddleware = jwt({ secret: process.env.JWT_SECRET })
99

1010
router.get('/', async (ctx, next) => {
11-
ctx.body = { message: 'Hi there.' }
11+
console.log(ctx.request.ip)
12+
ctx.body = { message: 'Hi there.', ctx: ctx.request.ip }
1213
})
1314

1415
//Initial controller once for all routes

0 commit comments

Comments
 (0)