Skip to content

Commit d4eee59

Browse files
committed
Add Routes
1 parent ea0ce51 commit d4eee59

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

index.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ if (import.meta.url === `file://${process.argv[1]}`) {
4444
silent: args.silent || false,
4545
});
4646

47-
await server(config);
47+
const sm = await server(config);
48+
console.log('Server started, listening:', sm.server.listening);
4849
}
4950

5051
export default async function server(config: Config): Promise<ServerManager> {
@@ -157,15 +158,25 @@ export default async function server(config: Config): Promise<ServerManager> {
157158
app.use(express.static('web/dist'));
158159

159160
return new Promise((resolve) => {
160-
const srv = app.listen(5003, () => {
161+
const srv = app.listen(5004, () => {
161162
if (!config.silent) {
162-
console.log('ok - http://localhost:5003');
163+
console.log('ok - http://localhost:5004');
163164
}
165+
console.log('Inside callback, listening:', srv.listening);
166+
console.log('Address:', srv.address());
164167

165168
const sm = new ServerManager(srv, config);
166169

167170
return resolve(sm);
168171
});
172+
173+
srv.on('close', () => {
174+
console.log('Server closed');
175+
});
176+
177+
srv.on('error', (err) => {
178+
console.error('Server error:', err);
179+
});
169180
});
170181
}
171182

routes/login.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fetch from '../lib/fetch.js'
2+
import Err from '@openaddresses/batch-error'
23
import { Type } from '@sinclair/typebox'
34
import Config from '../lib/config.js'
45
import Schema from '@openaddresses/batch-schema'

web/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default defineConfig(({ mode }) => {
2424
proxy: {
2525
'/api': {
2626
ws: true,
27-
target: 'http://localhost:5003',
27+
target: 'http://localhost:5004',
2828
changeOrigin: true,
2929
}
3030
}

0 commit comments

Comments
 (0)