From 5b315f306a8b5aa03e33fc659b3666bd59308869 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Mon, 27 May 2024 15:09:45 -0400 Subject: [PATCH] add backend javascript project --- backend-js/package.json | 19 +++++++++++++++++++ backend-js/src/server.js | 11 +++++++++++ 2 files changed, 30 insertions(+) create mode 100644 backend-js/package.json create mode 100644 backend-js/src/server.js diff --git a/backend-js/package.json b/backend-js/package.json new file mode 100644 index 0000000..e2c8545 --- /dev/null +++ b/backend-js/package.json @@ -0,0 +1,19 @@ +{ + "name": "pubapptest-backend-js", + "version": "1.0.0", + "description": "", + "main": "src/server.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/mdchap/pubapptest.git" + }, + "author": "Matt Chapman ", + "license": "MIT", + "bugs": { + "url": "https://github.com/mdchap/pubapptest/issues" + }, + "homepage": "https://github.com/mdchap/pubapptest#readme" +} diff --git a/backend-js/src/server.js b/backend-js/src/server.js new file mode 100644 index 0000000..9e5a3fc --- /dev/null +++ b/backend-js/src/server.js @@ -0,0 +1,11 @@ +import express from 'express'; +import bodyParser from 'body-parser'; +import cors from 'cors'; + +const app = express(); +app.use(cors()); +app.use(bodyParser.json()); + +app.get('/api', (req, res) => { + res.json({ message: 'Hello from server!' }); +});