joplin-notes/joplin notion extension/Web Development/heroku/Bohr io.md
2026-11-04 00:33:23 +05:30

58 lines
981 B
Markdown

Bohr io
[express-template-main.zip](../../../_resources/express-template-main.zip)
server.ts
```jsx
import express, { Response, Request } from "express";
var app = express();
const users = [
{ id: 1, name: "Lucas" },
{ id: 2, name: "Eric" },
{ id: 3, name: "Ana" },
];
app.get("/", function (req: Request, res: Response) {
res.send("Bohr Express template");
});
app.get("/users", function (req: Request, res: Response) {
res.send(users);
});
app.get("/users/:userId", function (req: Request, res: Response) {
const user = users.find((user) => user.id === parseInt(req.params.userId));
res.send(user);
});
if (!module.parent) {
app.listen(3000);
console.log("Express started on port 3000");
}
export default app;
```
index.ts
```jsx
const serverless = require('serverless-http');
import app from './server';
module.exports.handler = serverless(app);
```
 
Commands
![boris io commands.png](../../../_resources/boris%20io%20commands.png)