Xin Meng reported an error when he met node. Please ask the elder for advice.

  node.js, question

The code is as follows

//Introduce Dependency
 const express = require('express')
 const superagent = require('superagent')
 const cheerio = require('cheerio')
 //Create express Instance
 const app = express()
 app.get('/', (req, res) => {
 .end((err, sres) => {
 if (err) { return next(err) }
 let $ = cheerio.load(sres.text);
 let items = $('#topic_list .topic_title').map((item) => {
 let $item = $(item)
 return {
 title: $item.attr('title'),
 href: $item.attr('href')
 app.listen(3000, () => { console.log('app is listening at port 3000') })

The error was reported as follows:

TypeError: Converting circular structure to JSON
 at Object.stringify (native)
 at stringify
 at ServerResponse.json
 at ServerResponse.send
 at superagent.get.end
 at Request.callback
 at Stream.<anonymous>
 at emitNone (events.js:86:13)
 at Stream.emit (events.js:185:7)
 at Unzip.<anonymous>

No reason was found.

You’re not passing JSON data, are you?

Try res.json (…)

However, in order to introduce bodyParser, npm install it first and then:
var bodyParser = require('body-parser');

It is suggested that the novice first use the template framework generated by express to see how the template is written.

So you can now:

Google explains how to generate express templates.

Turn send in res.send into json