Skip to content

I have created the backend for a car sales and rental company website using Sanity.io as the content management system.

Notifications You must be signed in to change notification settings

a-abrham/WheelzHub-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is Sanity

It is headless content managment system, that will enable you to store and manage your data.

I'll post a step by step guide on how we can use it... very soon

Why Sanity?

  • Easy to custmoize
  • Nice documentation
  • 100k API requests per Month
  • 5 GB storage per project
  • Perfect for medium sized projects.

Features

Add Remove Edit Car Details

It is easy doing such actions once you understand the dashboard. Lets see

The Models

alt text

Manufacturer Model

alt text

Status Model

alt text

The Car Model & How it is linked with the the above Models

alt text

alt text

How can we add cars?

alt text

How can we remove or Edit Car Details?

alt text

Access for the API

Sanity Studio provides an easy way to access APIs through its built-in HTTP client. This allows you to retrieve and update data from external APIs directly within the Sanity Studio interface.

To allow a website to access an API created using Sanity.io, you will need to enable CORS (Cross-Origin Resource Sharing) for your Sanity.io project.

You can configure it in sanity.json file

To enable CORS for your Sanity.io project, you can add a cors configuration object to your sanity.json file. Here's an example:

{
  "api": {
    "projectId": "your-project-id",
    "dataset": "your-dataset-name",
    "cors": {
      "allowOrigins": ["https://example.com"],
      "allowCredentials": true,
      "allowHeaders": ["Authorization"],
      "maxAge": 86400
    }
  }
}

Or easily from the dashboard

Step 1: Head to the dashboard and under the the CORS orgins look out for the allowed hosts

alt text

Step 2: Grab the link of the website that you want your api to be accessed

alt text
Step 3: Add it to the list

alt text

Step 4: Done. Now your website can use the API to fetch the data

alt text

Add Members

Step 1: Head to the dashboard and under the the Members look out for "Invite project members"

alt text

Step 2: Add the email and the role

alt text

Step 3: Once you are done, send the invite

alt text

About

I have created the backend for a car sales and rental company website using Sanity.io as the content management system.

Topics

Resources

Stars

Watchers

Forks