Setup -App -Dateien im Knoten JS einrichten
const express = require ('express')
const path = require('path')
const app = express()
///npm install body-paraser
const bodypraser = require('body-parser');
app.use(bodypraser.json())
app.use(bodypraser.urlencoded({extended:true}))
//setup static and middleware
app.use(express.static('./public'))
app.get('/', (req, res) =>{
console.log('user hit the resource')
res.sendFile(path.resolve(__dirname, '../../02-express-tutorial/navbar-app/index.html'))
})
app.get('/contact', (req, res) => {
console.log('user is on contact page')
res.send('Contact Page')
})
app.get('*', (req, res) =>{
res.status(404).send("<h1> Resource not found </h1>")
})
app.listen(5000, () => {
console.log('server is listing on port 5000....');
})
Embarrassed Elephant