This is the color palette API for my Frontend Masters React Native course.
Hosted version: https://color-palette-api.kadikraman.now.sh/palettes
yarn
yarn dev
The api will be served from http://localhost:3000/palettes
This api is set up to be deployed using Zeit Now.
Install the cli:
npm i -g now
Deploy:
now
You will have to create an account and/or log in first.
Note: the POST requests will work, but will not persist in the cloud function (we're only saving the data in memory), but it will persist while the server is running if you run it locally. Intended for learning purposes only.
[
{
id: <number>,
paletteName: <string>,
colors: [
{
colorName: <string>,
hexCode: <string>,
}
...
]
},
...
]
{
id: <number>,
paletteName: <string>,
colors: [
{
colorName: <string>,
hexCode: <string>,
}
...
]
}
Method body:
{
id: <number>,
paletteName: <string>,
colors: [
{
colorName: <string>,
hexCode: <string>,
}
...
]
}
e.g.
await fetch("http://localhost:3000/palettes", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
paletteName: "New palette",
colors: [
{ colorName: "Brown", hexCode: "#655643" },
{ colorName: "Teal", hexCode: "#80BCA3" },
{ colorName: "Yellowish", hexCode: "#F6F7BD" },
{ colorName: "Yellow", hexCode: "#E6AC27" },
{ colorName: "Red", hexCode: "#BF4D28" }
]
})
});