-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
28 lines (21 loc) · 805 Bytes
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// server starts up find when this import is used
import { testNodeLib } from '@test-nx-express/test-node-lib'
// error is thrown when this import is used
// `Watch error: Daemon closed the connection`
// import { testJsLib } from '@test-nx-express/test-js-lib'
/**
* This is not a production server yet!
* This is only a minimal backend to get started.
*/
import express from 'express';
import * as path from 'path';
const app = express();
app.use('/assets', express.static(path.join(__dirname, 'assets')));
app.get('/api', (req, res) => {
res.send({ message: 'Welcome to test-nx-express!' + testNodeLib() });
});
const port = process.env.PORT || 3333;
const server = app.listen(port, () => {
console.log(`Listening at http://localhost:${port}/api`);
});
server.on('error', console.error);