Basic HTML framework

This commit is contained in:
2019-05-19 18:48:50 +05:30
parent eaac6a03d1
commit a8754d2f03
5 changed files with 117 additions and 3 deletions

View File

@@ -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}`)
})