Node JS and Webpack Unexpected token <

前端 未结 5 848
旧巷少年郎
旧巷少年郎 2020-12-01 05:41

I\'ve started studing Node JS.

So here is my files.

index.html





        
5条回答
  •  天命终不由人
    2020-12-01 06:17

    Express Users :

    Let the Node server know the location of your static files

    Notice this line >> app.use(express.static('public'))

    //server.js
    const express = require('express')
    const app = express()
    // serve static assets from the public folder in project root
    app.use(express.static('public')) 
    //
    app.listen(8080, () => console.log('listening...'))
    

    DOCS - https://expressjs.com/en/starter/static-files.html

    Good Luck.

提交回复
热议问题