Skip to content

thewerther/webserver

Repository files navigation

Webserver written in Go

routes

  • /api/users
    • POST create user by specifying email and password in the request body
      • returns user credentials, a refresh token and an access token that is valid for an hour
    • PUT update user credentials by specifying an access token in the request header
  • /api/login
    • POST returns access token when specifying valid user credentials in the request body
  • /api/refresh
    • POST return a new access token when specifying a valid refresh token
  • /api/revoke
    • POST revokes a refresh token
  • /api/chirps
    • POST create a post by specifying the text in the request body and a valid access token in the request header
    • GET returns all posts
    • GET /api/chirps/{chirpID} returns a post by ID
    • DELETE /api/chirps/{chirpID} deletes an existing chirp by ID
  • /api/polka/webhooks
    • POST update user to premium by specifying a valid apiKey in the request header and a valid userID in the request body
  • /admin/metrics
    • GET shows all file server hits
  • /admin/reset
    • POST clears database

Database

  • migrations done through goose by using either migrateUp.sh or migrateDown.sh
  • for database schema see /sql/schema/
  • queries generated by sqlc, see query definitions at /sql/queries/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages