This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createHandler, Post, Delete, Get } from '@storyofams/next-api-decorators'; | |
import { requiresAuth } from './requires-auth.ts' | |
class ItemHandler { | |
@requiresAuth() | |
@Post() | |
async create() { | |
doSomething(); | |
return { name: 'John Doe' }; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller, Get } from '@nestjs/common'; | |
@Controller('cats') | |
export class CatsController { | |
@Get() | |
findAll(): string { | |
return 'This action returns all cats'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function handler(req, res) { | |
if (req.method === 'POST') { | |
checkAuth(); | |
doSomething(); | |
res.status(200).json({ name: 'John Doe' }) | |
} else if (req.method === 'DELETE') { | |
checkAuth(); | |
doSomethingElse(); | |
res.status(200).json({ status: 'Deleted' }) | |
} else if (req.method === 'GET') { // no auth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function handler(req, res) { | |
res.status(200).json({ name: 'John Doe' }) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn create next-app --typescript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: rbs [-m] -b base_branch_name | |
function rbs() { | |
OPTIND=1 | |
BASE_BRANCH=develop | |
UPDATE_ACTION=rebase | |
while getopts "b:m" flag; do | |
case "${flag}" in |
NewerOlder