Skip to content
Snippets Groups Projects
Commit e46ce71a authored by Jonny Ngo Luong's avatar Jonny Ngo Luong
Browse files

Issue: Split up index and app for testing with Jest (#5)

parent 31a6a56f
No related branches found
No related tags found
1 merge request!5Resolve "Legge til kategorier"
import express, { Application } from 'express';
import routes from "./routes/routes";
import bodyParser from 'body-parser';
import cors from 'cors';
import mysql from 'mysql2';
// Boot express
const app: Application = express();
app.use(cors());
// Configuring body parser middleware
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
// Configuring json response
app.set("json spaces", 2);
app.use("/api", routes);
export default app;
\ No newline at end of file
import bodyParser from 'body-parser';
import cors from 'cors';
import express from 'express';
import routes from './routes/routes';
import mysql from 'mysql2';
import app from './app';
// REST API config
const app = express();
const port = 3000;
app.use(cors());
// Configuring body parser middleware
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
// Configuring json response
app.set("json spaces", 2);
app.use("/api", routes);
app.listen(port, () => {
console.log(`Listening on port ${port}!`)
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment