working on parsers

This commit is contained in:
jmosrael@gmail.com
2024-05-16 17:39:01 -07:00
parent 8fa06736b4
commit eef238c834
4 changed files with 67 additions and 1 deletions

View File

@@ -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 })
})