diff --git a/README.md b/README.md index 78d2e94..c0f6a1d 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Then you should be able to run the dev server : $ npm run dev ``` -You should now be able to access ethermaps on [`http://localhost:3000`](http://localhost:3000/) (or whichever port you configured in your `.env` file). +You should now be able to access ethermaps on [http://localhost:3000](http://localhost:3000/) (or whichever port you configured in your `.env` file). ## Desires diff --git a/backend/controllers/points.js b/backend/controllers/points.js index 5eb946c..ad908d1 100644 --- a/backend/controllers/points.js +++ b/backend/controllers/points.js @@ -1,11 +1,9 @@ import MapModel from '../db/models/map.js' -const setPoint = async (req, res, next) => { +const createPoint = async (req, res, next) => { try { const { mapId, point } = req.body - console.log(req.body) - const map = await MapModel.query().findById(mapId) const p = await map.$relatedQuery('map_points').insert(point) @@ -15,4 +13,13 @@ const setPoint = async (req, res, next) => { } } -export { setPoint } +const updatePoint = async (req, res, next) => { + +} + +const deletePoint = async (req, res, next) => { + +} + + +export { createPoint, updatePoint, deletePoint } diff --git a/backend/routes/api.js b/backend/routes/api.js index 8b3f37e..295fcc8 100644 --- a/backend/routes/api.js +++ b/backend/routes/api.js @@ -9,7 +9,7 @@ router.get('/maps', getAllMaps) router.get('/map/:mapName', getMapByName) // POINTS -import { setPoint } from '../controllers/points.js' -router.post('/point/add', setPoint) +import { createPoint } from '../controllers/points.js' +router.post('/point/add', createPoint) export default router diff --git a/backend/tests/routes.js b/backend/tests/routes.js index e453982..ea3959a 100644 --- a/backend/tests/routes.js +++ b/backend/tests/routes.js @@ -6,15 +6,14 @@ import request from 'supertest' import App from '../express.js' import db from '../db/DB.js' -test.before(async t => { +test.before(async () => { await db.migrate.latest() }) -test.serial('get "/" route should return body of "ethermap"', async t => { +test.failing('get "/" route should return status code of 200', async t => { const res = await request(App).get('/') t.is(res.status, 200) - t.is(res.text, 'ethermap') }) test.serial('get "/api/maps" route should return an object containing an array called "maps"', async t => {