Compare commits
4 Commits
84fee8b19a
...
01a786720b
Author | SHA1 | Date | |
---|---|---|---|
01a786720b | |||
8140d76240 | |||
6b46a0a69e | |||
03a4898553 |
@ -6,7 +6,9 @@
|
|||||||
"author": "Philipp Dormann <philipp.dormann1@gmail.com>",
|
"author": "Philipp Dormann <philipp.dormann1@gmail.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"consola": "^2.15.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
"jsonwebtoken": "^8.5.1",
|
||||||
"mysql": "^2.18.1",
|
"mysql": "^2.18.1",
|
||||||
"pg": "^8.5.1",
|
"pg": "^8.5.1",
|
||||||
"typeorm": "^0.2.29"
|
"typeorm": "^0.2.29"
|
||||||
@ -14,6 +16,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/dotenv-safe": "^8.1.1",
|
"@types/dotenv-safe": "^8.1.1",
|
||||||
"@types/express": "^4.17.9",
|
"@types/express": "^4.17.9",
|
||||||
|
"@types/jsonwebtoken": "^8.5.0",
|
||||||
"@types/node": "^14.14.9",
|
"@types/node": "^14.14.9",
|
||||||
"dotenv-safe": "^8.2.0",
|
"dotenv-safe": "^8.2.0",
|
||||||
"nodemon": "^2.0.6",
|
"nodemon": "^2.0.6",
|
||||||
|
24
src/app.ts
24
src/app.ts
@ -1,18 +1,32 @@
|
|||||||
import * as dotenvSafe from 'dotenv-safe';
|
import * as dotenvSafe from 'dotenv-safe';
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
|
import consola from 'consola';
|
||||||
|
import * as jwt from 'jsonwebtoken';
|
||||||
import { createConnection } from 'typeorm';
|
import { createConnection } from 'typeorm';
|
||||||
|
|
||||||
dotenvSafe.config();
|
dotenvSafe.config();
|
||||||
|
const app = express();
|
||||||
|
const PORT = process.env.APP_PORT || 4010;
|
||||||
|
|
||||||
createConnection()
|
createConnection()
|
||||||
.then((connection) => {
|
.then((connection) => {
|
||||||
const app = express();
|
app.get('/', (req, res) => {
|
||||||
const PORT = process.env.APP_PORT || 4010;
|
const encoded = jwt.sign({ key: 'value' }, 'secret');
|
||||||
app.get('/', (req, res) => res.send('Express + TypeScript Server'));
|
consola.info(encoded);
|
||||||
|
return res.send('Express + TypeScript Server');
|
||||||
|
});
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`⚡️[server]: Server is running at http://localhost:${PORT}`);
|
consola.success(`⚡️[server]: Server is running at http://localhost:${PORT}`);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
consola.error(err);
|
||||||
|
app.get('/', (req, res) => {
|
||||||
|
const encoded = jwt.sign({ key: 'value' }, 'secret');
|
||||||
|
consola.info(encoded);
|
||||||
|
return res.send('Express + TypeScript Server');
|
||||||
|
});
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
consola.success(`⚡️[server]: Server is running at http://localhost:${PORT}`);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user