-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
30 lines (23 loc) · 722 Bytes
/
index.ts
File metadata and controls
30 lines (23 loc) · 722 Bytes
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
29
30
require('dotenv').config();
import express from 'express';
import cors from 'cors';
import bodyParser from 'body-parser';
import { Request, RequestHandler, Response } from 'express-serve-static-core';
import * as Firebase from './Firebase';
const api = express();
api.use(
cors({
origin: '*',
optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204
})
);
// Body Parser Middleware
api.use(bodyParser.json() as unknown as RequestHandler);
(async function () {
const server = api.listen(process.env.PORT || 8080, function () {
// @ts-ignore
var port = server.address().port;
console.log('App now running on port', port);
});
api.post('/', Firebase.validateAuth);
})();