Skip to content

Commit d981284

Browse files
committed
API tests for users
1 parent 4650d0d commit d981284

File tree

7 files changed

+378
-20
lines changed

7 files changed

+378
-20
lines changed

README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
Prototype project - CRUD users on NODE.js without database ( use json.file as storage)
1+
Users API
22

3-
GET `curl http://localhost:3000/users`
4-
5-
POST `curl -X POST http://localhost:3000/users -H 'Content-Type: application/json' -d '{"name":"Ruslan", "id": "1"}'`
6-
7-
PATCH `curl -X PATCH http://localhost:3000/users/1 -H 'Content-Type: application/json' -d '{"name":"Ruslan changed"}'`
8-
9-
DELETE `curl -X DELETE http://localhost:3000/users/1`
10-
11-
TODO: tests, error handling
3+
`npm install && npm start`
4+
`npm test`

app.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
import express from 'express'
2-
import App from './controllers/users'
3-
4-
const app = express()
5-
app.use(express.json())
6-
7-
App(app)
1+
import createServer from './server'
2+
const app = createServer()
83

94
app.listen(process.env.PORT || 3000, () => {
105
console.log('Server runs !!')

0 commit comments

Comments
 (0)