https://beautifier.io/ сделать код красивым
This commit is contained in:
		
							parent
							
								
									096f60baa0
								
							
						
					
					
						commit
						c1d2600f92
					
				
							
								
								
									
										21
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								index.js
									
									
									
									
									
								
							| @ -15,14 +15,23 @@ | ||||
| //   })
 | ||||
| const fs = require('fs'); | ||||
| const http = require('node:http'); | ||||
| const { SerialPort } = require('serialport') | ||||
| const { ReadlineParser } = require('@serialport/parser-readline') | ||||
| const { | ||||
|   SerialPort | ||||
| } = require('serialport') | ||||
| const { | ||||
|   ReadlineParser | ||||
| } = require('@serialport/parser-readline') | ||||
| 
 | ||||
| const port = new SerialPort({ path: '/com9', baudRate: 9600 }) | ||||
| const port = new SerialPort({ | ||||
|   path: '/com9', | ||||
|   baudRate: 9600 | ||||
| }) | ||||
| 
 | ||||
| var str = ""; | ||||
| 
 | ||||
| const parser = port.pipe(new ReadlineParser({ delimiter: '\r\n' })) | ||||
| const parser = port.pipe(new ReadlineParser({ | ||||
|   delimiter: '\r\n' | ||||
| })) | ||||
| parser.on('data', (data) => { | ||||
|   if (str != data) { | ||||
|     console.log(data); | ||||
| @ -49,7 +58,9 @@ if(req.url=='/'){ | ||||
|       } | ||||
|     }) | ||||
|   } else if (req.url == '/pin') { | ||||
|     res.writeHead(200, {'Content-Type': 'application/json'}); | ||||
|     res.writeHead(200, { | ||||
|       'Content-Type': 'application/json' | ||||
|     }); | ||||
|     res.end(str); | ||||
|   } else { | ||||
|     res.writeHead(404, "Not Found"); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user