Skip to content

Commit 81793ff

Browse files
committed
file upload
1 parent 06e2b18 commit 81793ff

File tree

1,733 files changed

+231030
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,733 files changed

+231030
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const express=require('express');
2+
const bodyparser=require('body-parser');
3+
const path=require('path');
4+
const multer=require('multer');
5+
const exphbs=require('express-handlebars');
6+
7+
const app=express();
8+
9+
//set engine
10+
app.engine('handlebars',exphbs({ extname: "hbs", defaultLayout: false, layoutsDir: "views/ "}));
11+
app.set('view engine', 'handlebars');
12+
13+
//using json
14+
app.use(bodyparser.json());
15+
app.use(bodyparser.urlencoded({extended : false}));
16+
17+
//set static directory
18+
app.use('/public',express.static(path.join(__dirname + 'public')));
19+
20+
21+
const port=3000|| process.env.PORT;
22+
app.listen(port,function(res,err){
23+
console.log(`app is live at ${port}`);
24+
})

upload a file using multer/node_modules/.bin/handlebars

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

upload a file using multer/node_modules/.bin/handlebars.cmd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

upload a file using multer/node_modules/.bin/handlebars.ps1

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

upload a file using multer/node_modules/.bin/is-ci

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

upload a file using multer/node_modules/.bin/is-ci.cmd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

upload a file using multer/node_modules/.bin/is-ci.ps1

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

upload a file using multer/node_modules/.bin/mime

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

upload a file using multer/node_modules/.bin/mime.cmd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

upload a file using multer/node_modules/.bin/mime.ps1

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)