basic alpr interface

This commit is contained in:
2020-05-24 23:22:37 +03:00
parent 4666f95b43
commit 0753359f07
10 changed files with 556 additions and 42 deletions

36
src/rest/index.js Normal file
View File

@@ -0,0 +1,36 @@
import express from 'express';
import http from 'http';
import Hack from '../components/Hack';
const PORT = 3000;
class BasicApi {
app;
server;
hack;
constructor() {
this.app = express();
this.server = http.createServer(this.app);
this.hack = new Hack();
}
init() {
this.server.listen(PORT, () => {
console.log(`Server running at port ${PORT}`);
});
this.registerEndpoints();
}
registerEndpoints() {
this.app.get('/:plate', async ({ params }, response) => {
const { plate } = params;
await this.hack.init(plate);
response
.status(200)
.send(this.hack.getCar());
});
}
}
export default BasicApi;