Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

💧 Sample requests and documentation for creating your first authenticated Vapor API 💧

NotificationsYou must be signed in to change notification settings

jottenlips/VaporAuthTemplateRequestExamples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 

Repository files navigation

Make a new template

Install vapor using brew

brew install vapor/tap/vapor

Make a new vapor authenticated api

https://docs.vapor.codes/3.0/auth/getting-started/

vapor new hello --auth
cd hello

then

vapor build
vapor run

or

vapor xcode

Create user # VAPOR 3

curl -X "POST" "http://localhost:8080/users" \     -H 'Content-Type: application/json; charset=utf-8' \     -d $'{  "name": "",  "email": "",  "password": "",  "verifyPassword = ""}'

Login

curl -X "POST" "http://localhost:8080/login" \     -H 'Content-Type: application/json; charset=utf-8' \     -u 'myemail:mypassord' \     -d $'{}'

returnstoken to be used for protected routes.

Todo object

get todo

curl "http://localhost:8080/todos?" \     -H 'Authorization: Bearer mytokenhere' \     -H 'Content-Type: application/json; charset=utf-8' \     -d $'{}'

post todo

curl -X "POST" "http://localhost:8080/todos" \     -H 'Authorization: Bearer 0BMDp6YeOuH0qYYrXInDhA==' \     -H 'Content-Type: application/json; charset=utf-8' \     -d $'{  "title": "Do the dishes"}'

delete todo

curl -X "DELETE" "http://localhost:8080/todos/1" \     -H 'Authorization: Bearer 0BMDp6YeOuH0qYYrXInDhA==' \     -H 'Content-Type: application/json; charset=utf-8' \     -d $'{}'

Create user # VAPOR 2

register

## i-registercurl -X "POST" "http://localhost:8080/users" \     -H 'Content-Type: application/json; charset=utf-8' \     -d $'{  "name": "",  "email": "",  "password": ""}'

Login

login

curl -X "POST" "http://localhost:8080/login" \     -H 'Content-Type: application/json; charset=utf-8' \     -u 'myemail:mypassord' \     -d $'{}'

returnstoken to be used for protected routes.

Get protected data

me

curl "http://localhost:8080/me?" \     -H 'Authorization: Bearer mytokenhere' \     -H 'Content-Type: application/json; charset=utf-8' \     -d $'{}'

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp