working on parsers
This commit is contained in:
@@ -2,7 +2,7 @@ import express from 'express'
|
||||
import { json } from 'body-parser'
|
||||
import { Sequelize } from 'sequelize'
|
||||
import { database, Character, Game, Pick, App } from './db'
|
||||
import { lexr, orderByLexr, parseOrderByString } from './tokenizer'
|
||||
import { lexr, parseOrderByString, FilterParser } from './tokenizer'
|
||||
|
||||
const app = express()
|
||||
const jsonParser = json()
|
||||
@@ -50,6 +50,15 @@ app.post('/api/game', jsonParser, async (req, res) => {
|
||||
})
|
||||
const pageCount = Math.ceil((await Character.count()) / count)
|
||||
|
||||
let fp = new FilterParser()
|
||||
|
||||
fp.lexer
|
||||
.input(filter)
|
||||
.tokens()
|
||||
.forEach((t) => {
|
||||
console.log(t)
|
||||
})
|
||||
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.send({ gameData, pageCount })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user