How does express access html in a directory

  node.js, question

Static (_ _ dirname plus’ /public’) middleware was previously used. After putting my html into it and accessing it, I found that the ajax request in html was invalid.

What should I do if I want to use the form of links to directly access an html and allow network requests in this html?

I really appreciate it.

Can you provide more detailed information?

This way I use itexpress@4.13.4It is normal to implement a simple ajax get.

var path = require('path');
 var express = require('express');
 var app = express();
 //Define Static archival catalogue
 app.use(express.static(path.join(__dirname, 'public')));
 app.listen(3000, function () {
 console.log('app listening on port 3000');
<!  DOCTYPE html>
 <html lang="en">
 <meta charset="UTF-8">
 <title>Ajax - sample</title>
 <input type="text" name="username" />
 <button id="btn">Get user from Github</button>
 <div id="avatar"></div>
 <div id="username"></div>
 <div id="blog"></div>
 <script src="//"></script>
 $(function () {
 $('#btn').on('click', function (e) {
 var username = $('input[name=username]').val();
 $. get (''plus username, function (result) {
 console.log('ajax completed', result);
 var avatar = new Image(80, 80);
 avatar.src = result.avatar_url;
 var a = document.createElement('a');
 a.innerHTML = "BLOG"
 a.setAttribute('href', '');