Some checks failed
test / Test completion check (push) Has been cancelled
test / test (20, macos-latest) (push) Has been cancelled
test / test (20, ubuntu-latest) (push) Has been cancelled
test / test (20, windows-latest) (push) Has been cancelled
test / test (22, macos-latest) (push) Has been cancelled
test / test (22, ubuntu-latest) (push) Has been cancelled
test / test (22, windows-latest) (push) Has been cancelled
test / test (24, macos-latest) (push) Has been cancelled
test / test (24, ubuntu-latest) (push) Has been cancelled
test / test (24, windows-latest) (push) Has been cancelled
24 lines
534 B
JavaScript
24 lines
534 B
JavaScript
const express = require("express");
|
|
const cors = require("cors");
|
|
const bodyParser = require("body-parser");
|
|
const server = express();
|
|
|
|
server.use(cors());
|
|
server.use(bodyParser.json());
|
|
server.use(bodyParser.urlencoded({ extended: true }));
|
|
server.use((_, res, next) => {
|
|
res.header("Content-Type", "application/json; charset=utf-8");
|
|
next();
|
|
});
|
|
|
|
// "In memory" data store
|
|
let dataStore = require("./data/orders.js");
|
|
|
|
server.get("/orders", (_, res) => {
|
|
res.json(dataStore);
|
|
});
|
|
|
|
module.exports = {
|
|
server,
|
|
dataStore,
|
|
};
|