--- tags: music-library,solution,track --- # Add artist to database with MySQL2 ```javascript= exports.create = async (req, res) => { const db = await getDb(); const { name, genre } = req.body; try { await db.query(`INSERT INTO Artist (name, genre) VALUES ('${name}', '${genre}')`); res.sendStatus(201); } catch (err) { res.status(500).json(err); } db.end(); }; ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up