Basic HTML framework
This commit is contained in:
10
index.js
10
index.js
@@ -1,8 +1,14 @@
|
||||
|
||||
|
||||
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
const path = require('path')
|
||||
|
||||
const port = 8080;
|
||||
app = express()
|
||||
|
||||
//const DIR=JSON.parse()
|
||||
app.use(bodyParser.urlencoded({extended:false}))
|
||||
app.use(bodyParser.json())
|
||||
|
||||
@@ -16,7 +22,7 @@ app.post('/files/ls',(req,res)=>{
|
||||
console.log("Request attempted")
|
||||
})
|
||||
|
||||
app.get('/',express.static('static'));
|
||||
app.get( '/*', express.static( path.join(__dirname,'static') ) );
|
||||
|
||||
app.all('*',(req,res)=>{
|
||||
res.status(404).json({'error':404});
|
||||
@@ -24,5 +30,5 @@ app.all('*',(req,res)=>{
|
||||
})
|
||||
|
||||
app.listen(port,()=>{
|
||||
console.log(`Listening:${port}`)
|
||||
console.log(`Listening : ${port}`)
|
||||
})
|
||||
|
Reference in New Issue
Block a user