Upload file to Cloud Buckets
It uses IBM Cloud Object Storage for objects storage.
This is a Next.js project bootstrapped with create-next-app
.
In order to build this app, you will need:
- An IBM Cloud Account for Cloud Object Storage Service: Create an account with IBM Cloud for free.
- Node 12 (LTS) or greater: Install Node.
- Yarn for project dependencies management: Install Yarn.
Provision the Object Storage service clicking here
- From the main navigation menu (โฐ), select Resource list to find Cloud Object Storage service under Storage.
- Click on Cloud Object Storage service -> Service credentiais and click on New credential button to create a new credential.
- Click on Advanced options and turn on Include HMAC credential
- Click on Add button
- Collect the access_key_id and secret_access_key
- Click on Buckets and, on Create bucket button, fill all info and save it
- Click on your newly created bucket and on Configuration tab
- Scroll down to Endpoints and collet the public url
- Create a copy of
.env.example
file, naming it.env
in the root of the directory, this is where we'll put the project's environment variables. - Add your keys to the .env file:
BUCKET_PUBLIC_ENDPOINT=your-public-url:goes-here
ACCESS_KEY_ID=your-access_key_id:goes-here
SECRET_ACCESS_KEY=your-secret_access_key:goes-here
BUCKET_NAME=your-bucket_name:goes-here
- Navigate to project application directory and type into the console:
yarn
Yarn will download all project libraries
- To start your project, type into the console
yarn dev
Your project will be available on http://localhost:3000
- Alternatively, you can build the project for production using the following command
yarn build
Execute the production build using the following command
yarn start