I completely forget to add AccessControl to NFT.Sol and thank you for pointing that out to me. I will have to update my contract.
I will keep that in mind as I try and verify again after my changes. I may take you up on requesting for help as I keep getting errors.
For the JSON Api I followed the OpenSea MetaData Standards Documentation: https://docs.opensea.io/docs/metadata-standards and edited the NodeJs Server Example here following the GitHub Readme.md: https://github.com/ProjectOpenSea/metadata-api-nodejs
It was a sloppy edit but I needed something quick and dirty to get the Api Live. I edited the main body of index.js in the metadata-api-nodejs github
app.get('/api/token/:token_id', function(req, res) {
const tokenId = parseInt(req.params.token_id).toString()
const person = db[tokenId]
const bdayParts = person.birthday.split(' ')
const day = parseInt(bdayParts[1])
const month = parseInt(bdayParts[0])
const data = {
'name': 'Castle Rays',
'description': 'Bath, England - By: Proteu5.Art',
'image': `https://gateway.pinata.cloud/ipfs/QmdeyMmvrP9dfoimozomsewLtDvSevep6czviirmXMXkbX`
}
Removing all of the variables nullified the code I left in so that the output is as follows when hosted live:
{"name":"Castle Rays","description":"Bath, England - By: Proteu5.Art","image":"https://gateway.pinata.cloud/ipfs/QmdeyMmvrP9dfoimozomsewLtDvSevep6czviirmXMXkbX"}
Again, it was sloppy, but got the job done. I couldnāt find a good tutorial on hosting ERC721 Api data. I used Heroku to host the data.
Edit:
I cleaned up the NodeJS Api Example. All you have to do is edit constants.js with your base Heroku API and edit the metadata after deleting/commenting out the following:
const express = require('express')
const path = require('path')
const moment = require('moment')
const { HOST } = require('./src/constants')
const db = require('./src/database')
const PORT = process.env.PORT || 5000
const app = express()
.set('port', PORT)
.set('views', path.join(__dirname, 'views'))
.set('view engine', 'ejs')
// Static public files
app.use(express.static(path.join(__dirname, 'public')))
app.get('/', function(req, res) {
res.send('Get ready for OpenSea!');
})
app.get('/api/token/:token_id', function(req, res) {
const tokenId = parseInt(req.params.token_id).toString()
//const person = db[tokenId]
//const bdayParts = person.birthday.split(' ')
//const day = parseInt(bdayParts[1])
//const month = parseInt(bdayParts[0])
const data = {
'name': 'Castle Rays',
'description': 'Bath, England - By: Proteu5.Art',
'image': `https://gateway.pinata.cloud/ipfs/QmdeyMmvrP9dfoimozomsewLtDvSevep6czviirmXMXkbX`
}
res.send(data)
})
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
})
// returns the zodiac sign according to day and month ( https://coursesweb.net/javascript/zodiac-signs_cs )
//function zodiac(day, month) {
// var zodiac =['', 'Capricorn', 'Aquarius', 'Pisces', 'Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo', 'Libra', 'Scorpio', 'Sagittarius', 'Capricorn'];
// var last_day =['', 19, 18, 20, 20, 21, 21, 22, 22, 21, 22, 21, 20, 19];
// return (day > last_day[month]) ? zodiac[month*1 + 1] : zodiac[month];
//}
//function monthName(month) {
// const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
// ]
// return monthNames[month - 1]
//}
An ERC721 Token Tutorial for Art would be awesome!