Skip to content

Commit

Permalink
file upload e.g.
Browse files Browse the repository at this point in the history
  • Loading branch information
omnipounder committed Aug 7, 2021
1 parent d0f26cf commit 5471082
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ const app = uWS./* SSL*/App({
key_file_name: 'misc/key.pem',
cert_file_name: 'misc/cert.pem',
passphrase: '1234'
}).get('/*', (res, req) => {
}).get('/headerModificationExample', (res, req) => {
res.writeHeader('IsExample', 'Yes').end('Hello World!');
}).get('/fileUploadExample', (res, req) => {
res.onData((chunk, isLast) => {
/* Buffer this anywhere you want to */
console.log('Got chunk of data with length ' + chunk.byteLength + ', isLast: ' + isLast);

/* We respond when we are done */
if (isLast) {
res.end('Thanks for the data!');
}
});
})
.listen(port, (token) => {
if (token) {
Expand Down

0 comments on commit 5471082

Please sign in to comment.