Skip to content

buildweekpicasso/backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

147 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Picasso API Server

https://bw-picasso.herokuapp.com/

POST /auth/register

Expects JSON on the request body:

{
  "username": "example",
  "password": "example"
}

Returns 400 if username or password aren't present Returns 401 if credentials are invalid Returns 201 if user successfully created with token:

{
  "token": "example"
}

POST /auth/login

Expects JSON on the request body:

{
  "username": "example",
  "password": "example"
}

Returns 400 if username or password aren't present Returns 401 if credentials are invalid Returns 200 if successfully logged in with token:

{
  "token": "example"
}

POST /images/process

Expects JSON on the request body:

{
  "style": "example URL",
  "content": "example URL"
}

Returns 200 if images were processed successfully with:

{
  "output_url": "example URL"
}

Image upload

In React app, declare a base URL for the API

const API_URL = "http://localhost:5555"

then add a change handler or submit hanlder that uploads the file to `/images/upload"

const handleChange = ({ target: { files } }) => {
  const [file] = files
  let body = new FormData()
  body.append("user-image", file)
  Axios.post(`${API_URL}/images/upload/`, body)
}

Note: The field name needs to be user-image

About

node server for Picasso

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •