open port 10000
This commit is contained in:
parent
60ce95ff84
commit
332981c8b0
1 changed files with 5 additions and 5 deletions
10
server.js
10
server.js
|
|
@ -16,7 +16,7 @@ const { pipeline } = require('stream')
|
||||||
const pump = util.promisify(pipeline)
|
const pump = util.promisify(pipeline)
|
||||||
|
|
||||||
//uuid
|
//uuid
|
||||||
const {
|
const {
|
||||||
v1: uuidv1,
|
v1: uuidv1,
|
||||||
v4: uuidv4,
|
v4: uuidv4,
|
||||||
} = require('uuid');
|
} = require('uuid');
|
||||||
|
|
@ -42,13 +42,13 @@ fastify.get("/", function (request, reply) {
|
||||||
|
|
||||||
//'post'
|
//'post'
|
||||||
fastify.post("/", async function (request, reply) {
|
fastify.post("/", async function (request, reply) {
|
||||||
|
|
||||||
// -- "accumulate whole file in memory"
|
// -- "accumulate whole file in memory"
|
||||||
const data = await request.file()
|
const data = await request.file()
|
||||||
const buffer = await data.toBuffer()
|
const buffer = await data.toBuffer()
|
||||||
// <<< https://github.com/fastify/fastify-multipart/#accumulate-whole-file-in-memory
|
// <<< https://github.com/fastify/fastify-multipart/#accumulate-whole-file-in-memory
|
||||||
// ^--- this is needed.. dont understand fully, though. related to 'stream' receiving.
|
// ^--- this is needed.. dont understand fully, though. related to 'stream' receiving.
|
||||||
|
|
||||||
const client = new Client(server);
|
const client = new Client(server);
|
||||||
|
|
||||||
//create unique folder ==> timestamp + uuid
|
//create unique folder ==> timestamp + uuid
|
||||||
|
|
@ -66,11 +66,11 @@ fastify.post("/", async function (request, reply) {
|
||||||
});
|
});
|
||||||
|
|
||||||
//listen
|
//listen
|
||||||
fastify.listen(process.env.PORT, function (err, address) {
|
fastify.listen(10000, function (err, address) {
|
||||||
if (err) {
|
if (err) {
|
||||||
fastify.log.error(err)
|
fastify.log.error(err)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
console.log(`Your app is listening on ${address}`)
|
console.log(`Your app is listening on ${address}`)
|
||||||
fastify.log.info(`server listening on ${address}`)
|
fastify.log.info(`server listening on ${address}`)
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue