NOTE: until vapor (and related) fix their stuff, there'd be a bunch of compile warnings. Hang tight!!
Hey there!
This repo is a vapor-2
(a swift
framework) app template with auth routes, and it's ready to be deployed to Heroku
.
The main purpose of this is to serve me as a starting point for my apps and to inspire you to hack your own!
Or please feel free to just use this as a starting template for your apps!
You may also freely use any code from this repo without attribution.
If you want to reach out, please feel free to drop me a line here:
let account = ["true", "metal", "of", "steel"].joined(separator: ".")
let host = ["gmail", "com"].joined(separator: ".")
let res = [account, host].joined(separator: "@")
Cheers,
Dan
http://ios-engineer.com
Heroku
/postgres
readyHTTPS
only,HTTP
requests are rejected with 403 forbidden- Script for quick change of crypto.json keys
- Pre-populated with 4 user accounts -
u1
,u2
,u3
andu4
-
- passwod is
123
- same for all of them
- passwod is
-
- comes with pre-populated access tokens -
u1 token
,u2 token
,u3 token
andu4 token
- comes with pre-populated access tokens -
GET
/
,/hello
,/hello/name
-
- hello routes for quick tests
wss://host/ws
-
- a websocket connection, will reverse and return whatever you send it
POST
/register-
- send
username
andpassword
as form-data
- send
POST
/login-
- send credentials as HTTP basic auth
POST
/logout-
- auth protected, removes token
GET
/me-
- will return current username
GET
/users-
- will return list of all users (except for the one making the request)
There's an option to use vapor toolbelt
, but I prefer to do this manually:
- prepare heroku app
-
- create app
-
- add postgres database
-
- settings - add vapor buildpack: https://github.com/vapor-community/heroku-buildpack
git clone https://github.com/truemetal/vapor-2-heroku-auth-template.git
to your mac- generate crypto keys by running
./crypto.sh
git commit -am "new crypto keys"
git remote add heroku <your heroku app git url>
git push heroku master
git remote rm origin
git remote add origin <your repo path>
Contributions are welcome! Please just open an issue or send a pull request.