-
Notifications
You must be signed in to change notification settings - Fork 11
Routes and APIs
Song Zheng edited this page Mar 23, 2020
·
7 revisions
We need the following routes and API endpoints to power the following pages:
- Landing
- Login
- Signup
- Email Confirmation
- Database Setup
- Databases
The follow routes would be needed to power the pages above
Renders the login page
Renders the signup page
- Renders landing page if user is not logged in
- Renders render email confirmation page if user has not confirmed email.
- Renders database setup page if user has not created a database password.
- Renders the databases page
Destroys user's session cookies
APIs you need
Login user
passwords are base64 encoded so that if engineers are debugging something in production, they don't accidentally see each other's password.
{
username: 'username',
password: 'base64 encoded password',
email: '[email protected]'
}
{
status: 'success'
}
{
error: {
messages: ["username / password combination is not valid"]
}
}
Used to create a user. When this is successful, it means a new user has been created.
{
username: 'username',
password: 'base64 encoded password',
email: '[email protected]'
}
{
status: 'success'
}
{
error: {
message: ["username is taken", "password is too short", "email is invalid"]
}
}
{
type: 'email',
category: 'confirmation'
}
{
status: 'success'
}
{
error: {
message: 'Email delivery failed. Please try again.'
}
}
This updates the user with a database password for that user to use to create all databases.
{
password: 'base64 encoded password'
}
{
status: 'success'
}
{
error: {
message: 'database setup failed'
}
}
Create a database for the currently logged in user
base64 encoded JSON string
{
name: 'postgres'
}
{
status: 'success'
}
{
error: {
message: 'failed to create database'
}
}
Get all databases for the currently logged in user.
{
data: [{postgres: {connectionInfo:{...}}}, {mongoDB: {connectionInfo:{...}}, {neo4J: {connectionInfo: null}}}]
}
{
error: {
message: 'failed to get databases'
}
}