added /game/add, API hopefully finished
This commit is contained in:
parent
fff55edf79
commit
5f9a484285
19 changed files with 143 additions and 100 deletions
|
|
@ -3,6 +3,7 @@ import helmet from "helmet";
|
|||
import morgan from 'morgan';
|
||||
import {leaderboardRoute} from "./leaderboardRoute.js";
|
||||
import {userRoute} from "./userRoute.js";
|
||||
import {gameRoute} from "./gameRoute.js";
|
||||
|
||||
|
||||
const app = express()
|
||||
|
|
@ -10,24 +11,13 @@ const port = 3000
|
|||
|
||||
app.use(helmet())
|
||||
|
||||
|
||||
// configure & use logger
|
||||
let morganFormatted = morgan('[:date[iso]] :method :url - :status')
|
||||
app.use(morganFormatted);
|
||||
|
||||
|
||||
app.use(express.json())
|
||||
|
||||
app.use('/leaderboard', leaderboardRoute)
|
||||
app.use('/user', userRoute)
|
||||
|
||||
app.get('/helloworld', (req, res) => {
|
||||
res.json({message: "Hello World!"})
|
||||
})
|
||||
|
||||
app.post('/echo', async (req, res) => {
|
||||
res.json(req.body)
|
||||
})
|
||||
app.use('/game', gameRoute)
|
||||
|
||||
|
||||
app.listen(port, () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue