Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
ce3a3d8e
Unverified
Commit
ce3a3d8e
authored
Jan 05, 2022
by
Hung Viet Nguyen
Committed by
GitHub
Jan 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename api in with-redis example (#33016)
Co-authored-by:
JJ Kasper
<
jj@jjsweb.site
>
parent
0195a6f8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
create.js
examples/with-redis/pages/api/create.js
+1
-1
features.js
examples/with-redis/pages/api/features.js
+1
-1
subscribe.js
examples/with-redis/pages/api/subscribe.js
+1
-1
No files found.
examples/with-redis/pages/api/create.js
View file @
ce3a3d8e
...
@@ -2,7 +2,7 @@ import { v4 as uuidv4 } from 'uuid'
...
@@ -2,7 +2,7 @@ import { v4 as uuidv4 } from 'uuid'
import
redis
from
'../../lib/redis'
import
redis
from
'../../lib/redis'
export
default
async
function
upvo
te
(
req
,
res
)
{
export
default
async
function
crea
te
(
req
,
res
)
{
const
{
title
}
=
req
.
body
const
{
title
}
=
req
.
body
if
(
!
title
)
{
if
(
!
title
)
{
...
...
examples/with-redis/pages/api/features.js
View file @
ce3a3d8e
import
redis
from
'../../lib/redis'
import
redis
from
'../../lib/redis'
export
default
async
function
upvote
(
req
,
res
)
{
export
default
async
function
getAllFeatures
(
req
,
res
)
{
const
features
=
(
await
redis
.
hvals
(
'features'
))
const
features
=
(
await
redis
.
hvals
(
'features'
))
.
map
((
entry
)
=>
JSON
.
parse
(
entry
))
.
map
((
entry
)
=>
JSON
.
parse
(
entry
))
.
sort
((
a
,
b
)
=>
b
.
score
-
a
.
score
)
.
sort
((
a
,
b
)
=>
b
.
score
-
a
.
score
)
...
...
examples/with-redis/pages/api/subscribe.js
View file @
ce3a3d8e
import
redis
from
'../../lib/redis'
import
redis
from
'../../lib/redis'
export
default
async
function
upvot
e
(
req
,
res
)
{
export
default
async
function
subscrib
e
(
req
,
res
)
{
const
{
email
}
=
req
.
body
const
{
email
}
=
req
.
body
if
(
email
&&
validateEmail
(
email
))
{
if
(
email
&&
validateEmail
(
email
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment